发布网友 发布时间:2023-09-17 15:55
共1个回答
热心网友 时间:2024-12-04 09:01
K1 EQU P1.0
K2 EQU P1.1
K3 EQU P1.2
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP T0ISR
ORG 0030H
MAIN:
MOV TMOD,#01H
MOV TH0,#HIGH(65536-10000)
MOV TL0,#LOW(65536-10000)
SETB ET0
SETB TR0
SETB EA
MOV R0,#9
MOV R1,#9
MOV R2,#0
MOV R3,#99
CLR 00H
CLR 01H
LOOP:
JB K1,LP01
JNB K1,$
CLR 01H
INC R3
CJNE R3,#100,LOOP0
MOV R3,#0
SJMP LOOP0
LP01:
JB K2,LP02
JNB K2,$
CLR 01H
CJNE R3,#0,LP011
MOV R3,#99
SJMP LOOP0
LP011:
DEC R3
SJMP LOOP0
LP02:
JB K3,LOOP
JNB K3,$
SETB 01H
SJMP LOOP
LOOP0:
MOV A,R3
MOV B,#10
DIV AB
MOV R0,B
MOV R1,A
SJMP LOOP
T0ISR:
CLR TR0
MOV TH0,#HIGH(65536-10000)
MOV TL0,#LOW(65536-10000)
SETB TR0
MOV DPTR,#TABLE
T0C:
CPL 00H
JB 00H,T001
MOV P3,#0FDH
MOV A,R1
MOVC A,@A+DPTR
MOV P2,A
SJMP T002
T001:
MOV P3,#0FEH
MOV A,R0
MOVC A,@A+DPTR
MOV P2,A
T002:
JNB 01H,T0E
INC R2
MOV A,R2
CJNE A,#100,T0E
MOV R2,#0
MOV A,R0
JZ T003
DEC R0
SJMP T0E
T003:
MOV A,R1
JZ T004
DEC R1
MOV R0,#9
T0E:
RETI
T004:
CLR 01H
MOV R4,#16
T005:
CPL P0.0
LCALL DELAY
DJNZ R4,T005
RETI
DELAY:
MOV R6,#200
DLY:
MOV R7,#250
DJNZ R7,$
DJNZ R6,DLY
RET
TABLE: ; 共阴极数码管显示代码表
DB 3FH,06H,5BH,4FH,66H ;01234
DB 6DH,7DH,07H,7FH,6FH ;56789
END
追问非常感谢您的回答,您的程序有一点难啊,有些超过目前学习掌握的范围了