📄 ice153.dt
字号:
call delay
jbs port5, 3
bs port62, output0
nop
/**************************************/
port64_check:
mov a, @0x0f ;set P64 output,others input
iow P5CR
mov a, @0xef
iow P6CR
bs port6, 4
call delay
jbc port5, 3
bs port64, output1
nop
bc port6, 4
call delay
jbs port5, 3
bs port64, output0
nop
/**************************************/
port65_check:
mov a, @0x0f ;set P65 output,others input
iow P5CR
mov a, @0xdf
iow P6CR
bs port6, 5
call delay
jbc port5, 3
bs port65, output1
nop
bc port6, 5
call delay
jbs port5, 3
bs port65, output0
nop
/**************************************/
port66_check:
mov a, @0x0f ;set P66 output,others input
iow P5CR
mov a, @0xbf
iow P6CR
bs port6, 6
call delay
jbc port5, 3
bs port66, output1
nop
bc port6, 6
call delay
jbs port5, 3
bs port66, output0
nop
/**************************************/
port67_check:
mov a, @0x0f ;set P67 output,others input
iow P5CR
mov a, @0x7f
iow P6CR
bs port6, 7
call delay
jbc port5, 3
bs port67, output1
nop
bc port6, 7
call delay
jbs port5, 3
bs port67, output0
nop
/**************************************/
p67pull_high:
mov a, @0xff
iow PDCR
mov a, @0x7f
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 7
bs pullhigh_buf,p67_high
nop
/**************************************/
p50pull_down:
mov a, @0xff
iow PHCR
mov a, @0xfe
iow PDCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbs port5, 0
bs pulldown_buf,p50_down
nop
/**************************************/
p66pull_high:
mov a, @0xff
iow PDCR
mov a, @0xbf
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 6
bs pullhigh_buf,p66_high
nop
/**************************************/
p51pull_down:
mov a, @0xff
iow PHCR
mov a, @0xfd
iow PDCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbs port5, 1
bs pulldown_buf,p51_down
nop
/**************************************/
p65pull_high:
mov a, @0xff
iow PDCR
mov a, @0xdf
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 5
bs pullhigh_buf,p65_high
nop
/**************************************/
p52pull_down:
mov a, @0xff
iow PHCR
mov a, @0xfb
iow PDCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbs port5, 2
bs pulldown_buf,p52_down
nop
/**************************************/
p64pull_high:
mov a, @0xff
iow PDCR
mov a, @0xef
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 4
bs pullhigh_buf,p64_high
nop
/**************************************/
p60pull_down:
mov a, @0xff
iow PHCR
mov a, @0xef
iow PDCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbs port6, 0
bs pulldown_buf,p60_down
nop
/**************************************/
p62pull_high:
mov a, @0xff
iow PDCR
mov a, @0xfb
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 2
bs pullhigh_buf,p62_high
nop
/**************************************/
p61pull_down:
mov a, @0xff
iow PHCR
mov a, @0xdf
iow PDCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbs port6, 1
bs pulldown_buf,p61_down
nop
/**************************************/
p61pull_high:
mov a, @0xff
iow PDCR
mov a, @0xfd
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 1
bs pullhigh_buf,p61_high
nop
/**************************************/
p62pull_down:
mov a, @0xff
iow PHCR
mov a, @0xbf
iow PDCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbs port6, 2
bs pulldown_buf,p62_down
nop
/**************************************/
p60pull_high:
mov a, @0xff
iow PDCR
mov a, @0xfe
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff
iow P6CR
call delay
jbc port6, 0
bs pullhigh_buf,p60_high
nop
/**************************************/
tcc_check: mov a, @0xff
iow PDCR
mov a, @0xff
iow PHCR
mov a, @0x0f ;set tcc interrupt
iow P5CR
mov a, @0xff
iow P6CR
mov a, @0x00
contw
clr RF
mov a, @0x37
mov tcc, a
mov a, @0x01
iow IOCF
eni
call delay
mov a, @0x00
iow IOCF
disi
/**************************************/
int0_check: mov a, @0x07 ;set P53 output,others input
iow P5CR
mov a, @0xff
iow P6CR
mov a, @0x40
iow WDTCR
clr RF
mov a, @0x04
iow IOCF
eni
bs port5, 3
call delay
bc port5, 3
call delay
mov a, @0x00
iow IOCF
disi
/**************************************/
port6_change:
mov a, @0x0e
contw
wdtc
mov a, @0x00
iow WDTCR
mov a, @0xfb ;set port60 pull-high
iow PHCR
mov a, @0x0f
iow P5CR
mov a, @0xff ;set port6 input
iow P6CR
nop
nop
nop
nop
nop
nop
nop
nop
mov port6, port6
eni
;disi
nop
nop
mov a, @0x02 ;enable port6 status change interrupt
iow IOCF
port6_change1:
nop
nop
slep
/**************************************/
nop
jbc flag, p62_flag
jmp port6_change2
call key_scan
jbs flag, key_over
jmp port6_change1
mov a, @0xff
mov port6_buf, a
;inc port6_buf
jmp wdt_check
port6_change2:
jbs flag, key_over
jmp port6_change1
;mov a, @0xff
;mov port6_buf, a
inc port6_buf
bc flag, p62_flag
/**************************************/
wdt_check: nop
inc wdt_buf
mov a, @0x8e
iow WDTCR
wdt_check1: nop
;wdtc
nop
nop
call delay
call delay
jmp wdt_check1
/**************************************/
intin: disi ;interrupt service routine
jbc RF, 0
jmp tcc_interrupt
jbc RF, 1
jmp port6_interrupt
jbc RF, 2
jmp int_interrupt
intin1: mov a, @0x00
mov RF, a
iow IOCF
reti
/**************************************/
tcc_interrupt:
nop ;tcc interrupt service routine
mov a, @0x06
and RF, a
inc tcc_buf
mov a, @0x01
iow IOCF
mov a, @0x37
mov tcc, a
reti
/**************************************/
port6_interrupt: ;port6 status change interrrupt service routine
nop
mov a, @0x00
iow WDTCR
call key_scan
bs flag, p62_flag
mov a, @0x05
and RF, a
mov a, @0x02
iow IOCF
reti
/**************************************/
int_interrupt: ;int0 interrupt service routine
mov a, @0x03
and RF, a
inc int0_buf
mov a, @0x04
iow IOCF
reti
/**************************************/
key_scan:
jbs port6, 2
jmp key_close
key_open:
jbs flag, key_flag
jmp key_open1
bc flag, key_flag
jmp key_scan
key_open1:
jbc flag, key_state
jmp key_open2
bc flag, key_over
jmp key_off
key_open2:
bs flag, key_over
bc flag, key_state
jmp key_off
/**************************************/
key_close:
jbc flag, key_flag
jmp key_close1
call delay
call delay
bs flag, key_flag
jmp key_scan
key_close1:
jbc flag, key_state
jmp key_close2
call delay
bs flag, key_state
key_close2:
call delay
jmp key_scan
key_off: nop
ret
/**************************************/
delay: nop
mov a, @0x04 ;delay 2ms
mov dt1, a
delay1: nop
mov a, @0xfa
mov dt2, a
delay2: nop
nop
djz dt2
jmp delay2
djz dt1
jmp delay1
nop
ret
/**************************************/
IO_error: nop
nop
nop
mov a, @0xff
mov port53, a
IO_error1: nop
nop
jmp IO_error
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -