Terry Woods
Member
- Join Date
- Apr 2002
- Posts
- 3,170
Actually, Johnny...
There were actually a couple of earlier versions. And I have to admit that originally there was a second rung... where the WAS_PB signal was RST after the PB was released.
The original version of this particular version addressed the issue of two alternating outputs. Again, the original had two rungs... the second was to RST WAS_PB.
This latest version has been modified to put it all into one rung. It still applies to a single output... OUT_1, or a dual, alternating, output.
Initial conditions, PB = OFF, WAS_PB = OFF, OUT_1 = OFF, OUT_2 = OFF
Push/Release once, OUT_1 = ON, OUT_2 = OFF (Already OFF)
Then Push/Release again, OUT_1 = OFF, OUT_2 = ON
Then Push/Release again, OUT_1 = ON, OUT_2 = OFF
...etc.
I get a kick out of seeing how far things can be... stretched? ...manipulated? It might be confusing to some of the inexperienced, and yet... it is still functional... and, if one just takes the time to understand how these damned things work, it is still rational!
This will not work in all PLCs. However, it will certainly work in an S7-200. I have it in place, and operating, at this moment.
I wouldn't try to guarantee this with a sloppy (normal-type?) switch. But I do guarantee it with a well-acting "snap-switch" (toggle-type).
A sloppy switch (a normal, left-right, rotating switch with a cam) would probably need a debouncer (extra line of code with a timer).
Granted... this could have been done with several rungs... but the original challenge, way-way-back-when, was to do it with as little code as possible.
(345)
There were actually a couple of earlier versions. And I have to admit that originally there was a second rung... where the WAS_PB signal was RST after the PB was released.
The original version of this particular version addressed the issue of two alternating outputs. Again, the original had two rungs... the second was to RST WAS_PB.
This latest version has been modified to put it all into one rung. It still applies to a single output... OUT_1, or a dual, alternating, output.
Initial conditions, PB = OFF, WAS_PB = OFF, OUT_1 = OFF, OUT_2 = OFF
Push/Release once, OUT_1 = ON, OUT_2 = OFF (Already OFF)
Then Push/Release again, OUT_1 = OFF, OUT_2 = ON
Then Push/Release again, OUT_1 = ON, OUT_2 = OFF
...etc.
WAS
PB PB
---| |---+---|/|------------+-----( SET ) WAS PB
| |
| +-----( SET ) FLIP
WAS |
PB | FLIP OUT_1
---| |---+---| |-----| |----+-----( RST ) OUT_1
| |
| +-----( SET ) OUT_2
| |
| +-----( RST ) FLIP
|
| FLIP OUT_1
+---| |-----|/|----+-----( SET ) OUT_1
| |
| +-----( RST ) OUT_2
| |
| +-----( RST ) FLIP
| PB
+---|/|------------------( RST ) WAS PB
I get a kick out of seeing how far things can be... stretched? ...manipulated? It might be confusing to some of the inexperienced, and yet... it is still functional... and, if one just takes the time to understand how these damned things work, it is still rational!
This will not work in all PLCs. However, it will certainly work in an S7-200. I have it in place, and operating, at this moment.
I wouldn't try to guarantee this with a sloppy (normal-type?) switch. But I do guarantee it with a well-acting "snap-switch" (toggle-type).
A sloppy switch (a normal, left-right, rotating switch with a cam) would probably need a debouncer (extra line of code with a timer).
Granted... this could have been done with several rungs... but the original challenge, way-way-back-when, was to do it with as little code as possible.
(345)
Last edited: