📄 顺流水灯.txt
字号:
loop: clr p1.0 ;清除p1.0,使其=0,LED1点亮
acall delay ;调用0.1秒延时子程序,等待0.1秒
setb p1.0 ;置高p1.0,使其=1,LED1熄灭
clr p1.1 ;点亮LED2
acall delay
setb p1.1 ;熄灭LED2
clr p1.2 ;点亮LED3
acall delay
setb p1.2 ;熄灭LED3
clr p1.3 ;点亮LED4
acall delay
setb p1.3 ;熄灭LED4
clr p1.4 ;点亮LED5
acall delay
setb p1.4 ;熄灭LED5
clr p1.5 ;点亮LED6
acall delay
setb p1.5 ;熄灭LED6
clr p1.6 ;点亮LED7
acall delay
setb p1.6 ;熄灭LED7
clr p1.7 ;点亮LED8
acall delay
setb p1.7 ;熄灭LED8
acall delay
ljmp loop ;8个LED流六了一遍后返回到标号LOOP处再循环
;延时子程序
delay: mov r0,#255 ;
dlo1: mov r1,#195
djnz r1,$
djnz r0,dlo1
ret ;查看 延时程序的原理
end
程序的第1到26行流水灯的主
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -