...按键控制四位数码管静态,动态或加1减1-类显示的实验汇编程序...
发布网友
发布时间:2024-04-21 09:45
我来回答
共2个回答
热心网友
时间:2024-04-21 18:25
SCANLED EQU 30H
ORG 0000H
LJMP MAIN
ORG 001BH
LJMP T1ISR ;扫描显示
ORG 0030H
MAIN:
MOV SP,#5FH
MOV TMOD,#10H
MOV TH1,#0ECH
MOV TL1,#078H
MOV SCANLED,#0
SETB ET1
SETB TR1
SETB EA
MOV 30H,#0
MOV 31H,#0
MOV 32H,#0
MOV 33H,#0
LOOP:
JB P1.0,LP1
JNB P1.0,$
INC 30H
MOV A,30H
CJNE A,#10,LOOP
MOV 30H,#0
SJMP LOOP
LP1:
JB P1.1,LP2
JNB P1.1,$
INC 31H
MOV A,31H
CJNE A,#10,LOOP
MOV 31H,30
SJMP LOOP
LP2:
JB P1.2,LP3
JNB P1.2,$
INC 32H
MOV A,32H
CJNE A,#10,LOOP
MOV 32H,#0
SJMP LOOP
LP3:
JB P1.3,LOOP
JNB P1.3,$
INC 33H
MOV A,33H
CJNE A,#10,LOOP
MOV 33H,#0
SJMP LOOP
;--------------------
T1ISR:
CLR TR1
MOV TH1,#0ECH
MOV TL1,#78H
SETB TR1
MOV DPTR,#LEDTAB
MOV R2,SCANLED
MOV A,#01H
CJNE R2,#0,T1DIS0
SJMP T1DIS1
T1DIS0:
RL A
DJNZ R2,T1DIS0
T1DIS1:
MOV P2,A
MOV A,SCANLED
ADD A,#30H
MOV A,@R0
MOVC A,@A+DPTR
MOV P0,A
INC SCANLED
MOV A,SCANLED
CJNE A,#4,T1END
MOV SCANLED,#0
T1END:
RETI
;--------------------
LEDTAB:
DB 0C0H ;"0" 00H
DB 0F9H ;"1" 01H
DB 0A4H ;"2" 02H
DB 0B0H ;"3" 03H
DB 99H ;"4" 04H
DB 92H ;"5" 05H
DB 82H ;"6" 06H
DB 0F8H ;"7" 07H
DB 80H ;"8" 08H
DB 90H ;"9" 09H
DB 88H ;"A" 0AH
DB 83H ;"B" 0BH
DB 0C6H ;"C" 0CH
DB 0A1H ;"D" 0DH
DB 86H ;"E" 0EH
DB 8EH ;"F" 0FH
DB 0FFH ;" " 10H
;--------------------
END
热心网友
时间:2024-04-21 18:26
哈哈?