交替时间太短,最快也要0.5秒的。用一块74LS164串进并出IC,51的RXD接164的AB端,TXD接164的CP.作为移位脉冲。
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:MOV SCON,#10H
MOV A,#0FEH
MOV SBUF,A
ST0:JNB TI,ST0
CLR TI
CALL DELAY
MOV A,#0FDH
MOV SBUF,A
ST1:JNB TI,ST1
CLR TI
CALL DELAY
MOV A,#0FBH
MOV SBUF,A
ST2:JNB TI,ST2
CLR TI
CALL DELAY
MOV A,#0F7H
MOV SBUF,A
ST3:JNB TI,ST3
CLR TI
CALL DELAY
MOV A,#0EFH
MOV SBUF,A
ST4:JNB TI,ST4
CLR TI
CALL DELAY
MOV A,#0DFH
MOV SBUF,A
ST5:JNB TI,ST5
CLR TI
CALL DELAY
MOV A,#0BFH
MOV SBUF,A
ST6:JNB TI,ST6
CLR TI
CALL DELAY
MOV A,#7FH
MOV SBUF,A
ST7:JNB TI,ST7
CLR TI
CALL DELAY
LJMP MAIN
DELAY:MOV R0,#250
D2:MOV R1,#250
D1:DJNZ R1,D1
DJNZ R0,D2
RET
END
温馨提示:答案为网友推荐,仅供参考