有八只彩灯控制要求,用一个启动一个停止按钮,从第一只开始到第八只,每隔1s依次点亮,全亮后全部灯灭1s亮1s,在按照从第八只到第一只依次灭1s,全灭后进入下一轮
最佳答案
ob35编程,周期是1s,mb10计数,初始值为0:
A START
JCN START1
S RUN
L 0
T MB10
R START
START1:A STOP
JCN STOP
R RUN
R STOP
STOP:NOP 0
A RUN
JCN END
L MB10
L 1
+I
T MB10
L 18
>I
JCN ***1
L 1
T MB10
***1:L MB10
JL M1
JU MM0
JU MM1
JU MM2
JU MM3
JU MM4
JU MM5
JU MM6
JU MM7
JU MM8
JU MM9//全灭
JU MM10//全亮
JU MM11
JU MM12
JU MM13
JU MM14
JU MM15
JU MM16
JU MM17
JU MM18
M1:JU END
MM0:NOP 0
JU END
MM1:S Q0.0
JU END
MM2:S Q0.1
JU END
MM3:S Q0.2
JU END
MM4:S Q0.3
JU END
MM5:S Q0.4
JU END
MM6:S Q0.5
JU END
MM7:S Q0.6
JU END
MM8:S Q0.7
JU END
MM9:L 0
T QB0
JU END
MM10:L 255
T QB0
JU END
MM11:R Q0.7
JU END
MM12:R Q0.6
JU END
MM13:R Q0.5
JU END
MM14:R Q0.4
JU END
MM15:R Q0.3
JU END
MM16:R Q0.2
JU END
MM17:R Q0.0
JU END
MM18:R Q0.0
END:NOP 0
提问者对于答案的评价:
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc168351.html