用一条8芯线,一端连接到P1口上,另一端连接到数码管的字段A-DP上(A连接p1.0,B连接p1.1,….),将第一个数码管的公共端X1接地GND
用T0定时50MS,定时初始值为3CB0H
T0中断定时,中断20次,约一秒
ORG 0000H
AJMP START
ORG 000BH
AJMP QQ1
START:MOV TMOD,#01H
MOV TL0,#0B0H
MOV TH0,#3CH
MOV R4,#14H
SETB EA
SETB ET0
SETB TR0
MOV 50H,#00H
ACALL DISP
QQ1:MOV 20H,A
CLR ET0
CLR TR0
MOV TL0,#0B0H
MOV TH0,#3CH
DJNZ R4,QQ3
MOV A,50H
SUBB A,#08H
JNZ QQ2
MOV 50H,#00H
AJMP QQ4
:QQ2:INC 50H
QQ4:MOV R4,#14H
QQ3:MOV A,20H
SETB TR0
SETB ET0
RETI
DISP : MOV R0,#50H
AGAIN: MOV A, @R0
MOV DPTR,#DSEG
MOVC A,@A+DPTR
MOV P1,A
AJMP DISP
DSEG:DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
END