原理图
程序如下 ORG 0000H JMP BEGIN TABLE: DB 3FH,06H,5BH,4FH,66H DB 6DH,7DH,07H,7FH DELAY: MOV R5,#20 LOOP4: MOV R6,#50H LOOP5: MOV R7,#100 DJNZ R7,$ DJNZ R6,LOOP5 DJNZ R5,LOOP4 RET BEGIN: MOV P2,#0FFH MOV R4,#0 MOV A,R4 AGAIN: MOV DPTR,#TABLE MOVC A,@A+DPTR MOV P1,A LOOP1: MOV A,P3 CPL A JZ LOOP1 LOOP2: RRC A INC R4 JNC LOOP2 MOV A,R4 MOVC A,@A+DPTR MOV P1,A LOOP3: JNB P2.2,BEGIN CPL P2.0 LCALL DELAY SJMP LOOP3 END
|