ORG 0000H
JMP START
START: MOV SCON,#00H
MOV DPTR,#TABLE
SETB P3.2
SETB P3.3
MOV A,#0FEH
LOOP:
MOV R3,#170
LOOP_1:
JNB P3.2,DISP_2345
JNB P3.3,DISP_8888
MOV 0030H,#0F7H
CALL DISPLAY
MOV 0030H,#0FBH
CALL DISPLAY
MOV 0030H,#0FDH
CALL DISPLAY
MOV 0030H,#0FEH
CALL DISPLAY
DJNZ R3,LOOP_1
RL A
JMP LOOP
;====================================
DISP_2345:
MOV R0,#2
MOV A,R0
MOVC A,@A+DPTR
MOV 0030H,#0F7H
CALL DISPLAY
INC R0
MOV A,R0
MOVC A,@A+DPTR
MOV 0030H,#0FBH
CALL DISPLAY
INC R0
MOV A,R0
MOVC A,@A+DPTR
MOV 0030H,#0FDH
CALL DISPLAY
INC R0
MOV A,R0
MOVC A,@A+DPTR
MOV 0030H,#0FEH
CALL DISPLAY
JMP START
;=================================
DISP_8888:
MOV A,#0
MOV 0030H,#0F7H
CALL DISPLAY
MOV 0030H,#0FBH
CALL DISPLAY
MOV 0030H,#0FDH
CALL DISPLAY
MOV 0030H,#0FEH
CALL DISPLAY
JMP START
;==================================
DISPLAY:
MOV R2,#4
SBUF_LOOP:
MOV SBUF,A
JNB TI,$
CLR TI
DJNZ R2,SBUF_LOOP
MOV P0,0030H
CALL DELAY_1
MOV P0,#0FFH
RET
;====================================
DELAY_1:
MOV R7,#30
D3: MOV R6,#50
DJNZ R6,$
DJNZ R7,D3
RET
;=============================================
TABLE:
DB 11000000B ;0
DB 11111001B ;1
DB 10100100B ;2
DB 10110000B ;3
DB 10011001B ;4
DB 10010010B ;5
DB 10000010B ;6
DB 11111000B ;7
DB 10000000B ;8
DB 10010000B ;9
END