XCH A,41H XCH A,42H XCH A,43H XCH A,44H XCH A,45H CALL DISP JMP L2 X3: JMP DISP2 X4: JMP COMP DISP:MOV R0,#45H DISP1: MOV A,@R0 ADD A,#50H MOV P0,A CALL DELAY DEC R0 MOV A,@R0 ADD A,#40H MOV P0,A CALL DELAY DEC R0 MOV A,@R0 ADD A,#30H MOV P0,A CALL DELAY
23
DEC R0 MOV A,@R0 ADD A,#20H MOV P0,A CALL DELAY DEC R0 MOV A,@R0 ADD A,#10H MOV P0,A CALL DELAY DEC R0 MOV A,@R0 ADD A,#00H MOV P0,A CALL DELAY RET SET0: MOV R2,#06H MOV R0,#40H MOV R1,#30H E1: MOV A,@R0 XCH A,@R1 INC R0 INC R1 DJNZ R2,E1
24
CALL DELAY E2: JMP START COMP: MOV R1,#45H MOV R0,#35H MOV R2,#06H C1: MOV A,@R1 XRL A,@R0 JNZ C3 DEC R1 DEC R0 DJNZ R2,C1 CLR P2.0 MOV R2,#200 C2: MOV R6,#248 DJNZ R6,$ DJNZ R2,C2 C3: INC R5 MOV A,R5 MOV R5,A
CJNE R5 ,#03H,C4 CLR P2.1 MOV R5,#00H C4: JMP START DISP2: MOV R0,#35H
25
CALL DISP MOV A,P1 XRL A,R4 JZ DISP2 CALL DELAY JMP START DELAY: MOV R7,#C3 D3: MOV R6,#248 DJNZ R7,D3 RET ORG 300H
TABLE: DB 01H 02H 03H 0CH DB 04H 05H 06H 0DH DB 07H 08H 09H 0EH DB 0AH 00H 0BH 0FH
DB 01H 02H 03H 04H 05H 06H END
26
硬件原理图
27