基于51单片机16个彩灯隔灯顺序点亮的汇编程序

如题所述

ORG 0000H
AJMP MAIN
ORG 0030H
MAIN: MOV R0,#8
MOV A,#0FEH
P_0: MOV P0,A
ACALL DLY200
RL A;
RL A;左移两个 所以调用两次RL
DJNZ R0,P_0
MOV P0,#0FFH
MOV R0,#8
MOV A,#0FEH
P_1: MOV P1,A
ACALL DLY200
RL A
RL A
DJNZ R0,P_1
MOV P1,#0FFH
MOV R0,#8
MOV A,#0FEH
P_2: MOV P2,A
ACALL DLY200
RL A
RL A
DJNZ R0,P_2
MOV P2,#0FFH
MOV R0,#8
MOV A,#0FEH
AJMP MAIN
DLY200: ;延时200us,误差 0us
MOV R7,#04H
DL1:
MOV R6,#74H
DL0:
MOV R5,#0D6H
DJNZ R5,$
DJNZ R6,DL0
DJNZ R7,DL1
NOP
RET
END
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-11-09
ORG 0000H
AJMP MAIN
ORG 0030H
MAIN: MOV R0,#8
MOV A,#0FEH
P_0: MOV P0,A
ACALL DLY200
RL A;
RL A;左移两个 所以调用两次RL
DJNZ R0,P_0
MOV P0,#0FFH
MOV R0,#8
MOV A,#0FEH
P_1: MOV P1,A
ACALL DLY200
RL A
RL A
DJNZ R0,P_1
MOV P1,#0FFH
MOV R0,#8
MOV A,#0FEH
P_2: MOV P2,A
ACALL DLY200
RL A
RL A
DJNZ R0,P_2
MOV P2,#0FFH
MOV R0,#8
MOV A,#0FEH
AJMP MAIN
DLY200: ;延时200us,误差 0us
MOV R7,#04H
DL1:
MOV R6,#74H
DL0:
MOV R5,#0D6H
DJNZ R5,$
DJNZ R6,DL0
DJNZ R7,DL1
NOP
RET
END
相似回答
大家正在搜