ORG 0000H
LJMP MAIN
ORG 0003H
LJMP INT_0
ORG 0013H
LJMP INT_1
ORG 0030H
MAIN: MOV SP,#30H
MOV IE,#85H
MOV IP,#04H
MOV TCON,#01H
LOOP: MOV P1,#0F3H
MOV R1,#88
CYCLE: MOV R0,#1
MOV R1,#5
AP1: LCALL DISPLAY
LCALL DELAY
DJNZ R1,AP1
MOV R1,#1
DEC R1
DJNZ R0,AP1
MOV R0,#0
MOV R1,#9
AP2: LCALL DISPLAY
CPL P1.2
LCALL DELAY
DJNZ R1,AP2
MOV P1,#0F5H
MOV R1,#3
MOV R2,#3
AP3: LCALL DISPLAY
LCALL DELAY
DJNZ R1,AP3
MOV P1,#0DEH
MOV R0,#2
MOV R1,#5
DEC R1
MOV R2,#1
DEC R0
DJNZ R2,AP3
MOV R0,#1
MOV R1,#5
BP1:
LCALL DISPLAY
LCALL DELAY
DJNZ R1,BP1
DEC R1
DJNZ R0,BP1
MOV R0,#0
MOV R1,#9
BP2:
LCALL DISPLAY
CPL P1.5
LCALL DELAY
DJNZ R1,BP2
MOV P1,#0EEH
MOV R1,#3
MOV R2,#3
MOV R1,#3
BP3:
LCALL DISPLAY
LCALL DELAY
DEC R1
DJNZ R2,BP3
SJMP LOOP
ORG 0200H
INT_0: PUSH P1
MOV P1,#0F6H
MOV B,R0
MOV R3,B
MOV B,R1
MOV R7,B
MOV R0,#1
MOV R1,#5
DELAZ: LCALL DISPLAY
LCALL DELAY
DJNZ R1,DELAZ
MOV R0,#2
MOV R1,#9
DEC R0
DJNZ R0,DELAZ
POP P1
MOV B,R3
MOV R0,B
MOV B,R7
MOV R1,B
RETI
ORG 0350H
INT_1: CLR EA
PUSH P1
PUSH 04H
PUSH 05H
PUSH 06H
SETB EA
JB P3.0,AP0
MOV P1,#0F3H
SJMP DEL1
AP0: JB P3.1,EXIT
MOV P1,#0DEH
DEL1: MOV B,R0
MOV R3,B
MOV B,R1
MOV R7,B
MOV R0,#1
MOV R1,#5
NEXT: LCALL DISPLAY
LCALL DELAY
DJNZ R1,NEXT
MOV R0,#2
MOV R1,#9
DEC R0
DJNZ R0,NEXT
MOV B,R3
MOV R0,B
MOV B,R7
MOV R1,B
EXIT: CLR EA
POP 06H
POP 05H
POP 04H
POP P1
SETB EA
RETI
ORG 0400H
DELAY: MOV R4,#10
LP1: MOV R5,#50
LP2: MOV R6,#248
NOP
LP3: DJNZ R6,LP3
DJNZ R5,LP2
DJNZ R4,LP1
RET
ORG 0600H
DISPLAY:MOV A,R0
MOV B,#10
DIV AB
ADD A,#10H
MOV P0,A
TI0: JB P3.4,TT
SJMP TI0
TT: SETB P3.4
MOV A,B
ADD A,#20H
MOV P0,A
TI1: JB P3.4,TT1
SJMP TI1
TT1: SETB P3.4
MOV A,R1
MOV B,#10
DIV AB
ADD A,#10H
MOV P2,A
TI2: JB P3.4,TT2
SJMP TI2
TT2: SETB P3.4
MOV A,B
ADD A,#20H
MOV P2,A
TI3: JB P3.4,TT3
SJMP TI3
TT3: SETB P3.4
LCALL DELAY
RET
END
|