求助,51单片机使8个发光二极管按0,2,4,6,1,3,5,7的顺序间隔点亮

2024-11-08 19:31:22
推荐回答(2个)
回答(1):

ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
MOV A,#0FEH
MOV R2,#4
LOOP1:
MOV P0,A
LCALL DELAY
DJNZ R2,LOOP1
MOV R2,#4
MOV A,#0FDH
LOOP2:
MOV P0,A
LCALL DELAY
DJNZ R2,LOOP2
SJMP MAIN
DELAY:
MOV R2,#200
DLY:
MOV R3,#250
DJNZ R3,$
DJNZ R2,DLY
RET
END

回答(2):

不会写的话,一句一句来,先输出0,延时,再输出 4 16 64……
1 3 5 7对应 1 8 32 128