单片机汇编语言24秒倒计时程序
- 格式:doc
- 大小:24.00 KB
- 文档页数:2
;24秒倒计时
ORG 0000H
LJMP M1
ORG 000BH
LJMP N1
ORG 0100H
M1: MOV R7,#20
MOV TMOD,#01H
MOV TH0,#4CH
MOV TL0,#00H
SETB ET0
SETB EA
SETB TR0
MOV 70H,#04H
MOV 71H,#02H
MOV 30H,#24H
L1: MOV DPTR,#TAB
MOV P2,#0FEH
MOV A,70H
MOVC A,@A+DPTR
MOV P0,A
LCALL DEL
MOV P2,#0FDH
MOV A,71H
MOVC A,@A+DPTR
MOV P0,A
LCALL DEL
SJMP L1
N1: DJNZ R7,M4
MOV R7,#20
MOV A,30H
CJNE A,#00H,M3
MOV A,#24H
MOV 30H,A
SJMP CHAI
M3: CLR C
ADD A,#99H
DA A
MOV 30H,A
CHAI: ANL A,#0FH
MOV 70H,A
MOV A,30H
SWAP A
ANL A,#0FH
MOV 71H,A
M4:
MOV TH0,#4CH
MOV TL0,#00H
RETI
TAB:DB 0C0H,0F9H,0A4H,0B0H,99H
DB 92H,82H,0F8H,80H,90H DEL: MOV R5,#250
LOOP: DJNZ R5,LOOP
RET
END