LED流水灯实验
(1)参考程序
ORG 0000h ;开始
AJMP LOOP ;到0030h处避开00~30的敏感地址
ORG 0030h
LOOP:
MOV p3,#offh ;关闭所有灯
clr p3.2
lcall delay
clr p3.3
lcall delay
clr p3.4
lcall delay
clr p3.5
lcall delay
clr p3.6
lcall delay
clr p3.7
lcall delay
AJMP LOOP ;到最开始loop处重新运行
delay: mov r5,#20 ;延时
d1:mov r6,#40
d2:mov r7,#248
djnz r7,$
djnz r6,d2
djnz r5,d1
ret
end