一个国外的PLC仿真软件
......
Our program will have three states: off, steady on, and blinking. The program should change its state on each rising edge of the signal from the pushbutton. This is a good application for a circular counter. We will say that ‘state 0’ is ‘off,’ ‘state 1’ is ‘steady on,’ and ‘state 2’ is ‘blinking.’ The counter counts 0, 1, 2, 0, 1, 2, ..., so if we just let the rung-in condition of the counter be the pushbutton input, then everything will work like we want:
|| Xbutton Cstate ||
2 ||-------] [---------------------------------------------{CTC 0:2}----||
Now the only thing left is to use the program state to set the state of the LED. We can do it like this:
|| [Cstate ==] Yled ||
3 ||---[ 1 ]-------------------+------------------------( )-------||
|| | ||
|| [Cstate ==] Rosc | ||
||---[ 2 ]----------] [------+ ||
......
猜您喜欢
评论