键控门铃程序
扫描二维码
随时随地手机看文章
键控门铃程序
;*****通过1*4按键的第3号键按下可听到门铃的声音
T5HzEQU30H
T7HZEQU31H
T05SAEQU32H
T05SBEQU33H
FLAGBIT00H
STOPBIT01H
SP1BITP1.0
ORG0000H
LJMPSTART
ORG000BH
LJMPINT_T0
START: MOV TMOD,#02H
MOV TH0,#06H
MOV TL0,#06H
SETBET0
SETBEA
NSP:JBSP1,NSP
LCALLDELY10MS
JBSP1,NSP
SETBTR0
MOV T5HZ,#00H
MOV T7HZ,#00H
MOV T05SA,#00H
MOV T05SB,#00H
CLRFLAG
CLRSTOP
JNBSTOP,$
LJMPNSP
DELY10MS: MOV R6,#20
D1: MOV R7,#248
DJNZR7,$
DJNZR6,D1
RET
INT_T0:INCT05SA
MOV A,T05SA
CJNEA,#100,NEXT
MOV T05SA,#00H
INCT05SB
MOV A,T05SB
CJNEA,#20,NEXT
MOV T05SB,#00H
JBFLAG,STP
CPLFLAG
LJMPNEXT
STP:SETBSTOP
CLRTR0
LJMPDONE
NEXT:JBFLAG,S5HZ
INCT7HZ
MOV A,T7HZ
CJNEA,#03H,DONE
MOV T7HZ,#00H
CPLP3.7
LJMPDONE
S5HZ:INCT5HZ
MOV A,T5HZ
CJNEA,#04H,DONE
MOV T5HZ,#00H
CPLP3.7
LJMPDONE
DONE:RETI
END