这个简单,采用带进位移位指令就可以实现,假如是高有效,程序如下。
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
MOV A,#01H
MOV P1,#01H
MOV P2,#00H
MOV P3,#00H
MOV R2,A
MOV R3,#00H
MOV R4,#00H
LOOP:
MOV P1,R2
MOV P2,R3
MOV P3,R4
LCALL DELAY
CLR C
MOV A,R2
RLC A
MOV R2,A
MOV A,R3
RLC A
MOV R3,A
MOV A,R4
RLC A
MOV R4,A
MOV A,R2
MOV ACC.0,C
MOV R2,A
LJM,P LOOP
DELAY:
MOV R5,#200
DLY1:
MOV R6,#250
DJNZ R6,$
DJNZ R5,DLY1
RET
END