采用51单片机汇编语言驱动 下面是电路图:
ORG 0000H
AJMP MAIN
ORG 0030H
MAIN: MOV P0,#00H
SETB P2.6
SETB P2.7
MOV R0,#00H
MOV R1,#00H
MOV R2,#888
MOV R3,#0AH
MOV R4,#0AH
MOV DPTR,#TABLE
L0: MOV A,R0
MOVC A,@A+DPTR
MOV P2,#040H
MOV P0,A
ACALL DELAY
MOV A,R1
MOVC A,@A+DPTR
MOV P2,#80H
MOV P0,A
ACALL DELAY
DJNZ R2,L0
INC R0
MOV R2,#888
DJNZ R3,L0
MOV R0,#00H
MOV R3,#0AH
INC R1
DJNZ R4,L0
AJMP MAIN
DELAY: ;误差 -0.868055555556us
MOV R6,#0FBH
DL0:
MOV R5,#04H
DJNZ R5,$
DJNZ R6,DL0
RET
TABLE: DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H,080H,090H
END
闲来无事学习一下,希望大家能给点儿建议,共同学习.
|