软件:proteus8、keil5
相较于数码管加减,显示数据则只需要将所想显示数据存入30~33H单元即可
ORG 0000H
AJMP MAIN
MAIN: LCALL CSH
MAIN1: LCALL XS
JMP MAIN1
CSH: MOV 30H,#1 ;30~33H保存数码管1~4显示数据,修改即可
MOV 31H,#2
MOV 32H,#3
MOV 33H,#4
RET
XS: MOV R7,#4
MOV R6,#0FEH
MOV R0,#30H
MOV DPTR,#TAB
LOOP: MOV A,@R0
MOVC A,@A+DPTR
MOV P0,A
MOV P2,R6
LCALL DELAY
MOV P2,#0FFH
MOV A,R6
RL A
MOV R6,A
INC R0
DJNZ R7,LOOP
RET
DELAY: MOV R5,#20
DJNZ R5,$
RET
TAB: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
END