START: MOV DPTR, #TABLE
MOV R0, #0
ACALL L_M
ACALL L_R
ACALL L_G
ACALL L_P
L_M: MOV P2,#11111110B
MOV A,R0
MOVC A,@A+DPTR
MOV P1,A
ACALL DLY1S
INC R0
CJNE R0,#10,L_R
MOV R0,#0
JMP L_R
L_R: MOV P2,#11111101B
MOV A,R0
MOVC A,@A+DPTR
MOV P1,A
ACALL DLY1S
INC R0
CJNE R0,#10,L_G
MOV R0,#0
JMP L_G
L_G: MOV P2,#11111011B
MOV A,R0
MOVC A,@A+DPTR
MOV P1,A
ACALL DLY1S
INC R0
CJNE R0,#10,L_P
MOV R0,#0
JMP L_P
L_P: MOV P2,#11110111B
MOV A,R0
MOVC A,@A+DPTR
MOV P1,A
ACALL DLY1S
INC R0
CJNE R0,#10,L_M
MOV R0,#0
JMP L_M
DLY1S: MOV R5,#50
D1: MOV R6,#100
D2: MOV R7,#100
DJNZ R7,$
DJNZ R6,D2
DJNZ R5,D1
RET
TABLE: DB 3FH,06H,5BH,4FH
DB 66H,6DH,7DH,07H
DB 7FH,6FH,77H,7CH
DB 39H,5EH,79H,71H
END
呵呵,脑子转不过来半天写完:D |