单片机60S倒计时汇编语言
2015-07-08 来源:51hei
ORG 0000H
进入单片机查看更多内容>>
AJMP MAIN
ORG 000BH
AJMP INTT0
ORG 0030H
MAIN: MOV R7,#60
MOV R6,#00H
MOV DPTR,#TABLE
MOV TMOD,#01H
MOV TL0,#0B0H
MOV TH0,#3CH ;设置定时器工作方式、初值
SETB EA
SETB ET0
SETB TR0
NEXT: MOV A,R7
MOV B,#0AH
DIV AB
SETB P1.3
MOVC A,@A+DPTR
MOV P0,A
CLR P1.4 ;开启shi位显示
ACALL DELAY
MOV A,B
SETB P1.4
MOVC A,@A+DPTR
MOV P0,A
CLR P1.3 ;开启ge位显示
ACALL DELAY
CJNE R6,#14H,NEXT
MOV R6,#00H
DEC R7
CJNE R7,#0FFH,NEXT
SJMP MAIN
INTT0:MOV TL0,#0B0H ;中断服务程序
MOV TH0,#3CH
INC R6
RETI
DELAY:MOV R5,#02H ;延时子程序
LOOP:MOV R4,#02H
DJNZ R4,$
DJNZ R5,LOOP
RET
TABLE:DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
END
相关文章