rg 0000h ;开始
ajmp loop
org 0080h ;到0030h处避开00-30的敏感地址
loop:
mov p0,#0ffh ;关闭所有灯
clr p0.0 ;点亮灯p0.0
lcall delay ;延时一段时间?
clr p0.1 ;点亮灯p0.1
lcall delay
clr p0.2 ;点亮灯p0.2
lcall delay
clr p0.3 ;点亮灯p0.3
lcall delay
clr p0.4 ;点亮灯p0.4
lcall delay
clr p0.5 ;点亮灯p0.5
lcall delay
clr p0.6 ;点亮灯p0.6
lcall delay
clr p0.7 ;点亮灯p0.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
温馨提示:答案为网友推荐,仅供参考