Terry Woods
Member
- Join Date
- Apr 2002
- Posts
- 3,170
FLIP-FLOP or FLIPFLOP or FLIP FLOP or TOGGLE or ONE BUTTON or ONE-BUTTON
This will work in ANY PLC. It is the "generic" solution for any PLC. It's only four Rungs in length and is totally transparent, to ANY PLC user, even Bubba! (OSR's can be confusing to some.)
The Flipping (Toggling) action takes place in only one scan.
This Rung watches for the PB to be pressed. When the PB transitions from NOT Pressed (OFF) to Pressed (ON), "FLIP-BIT" goes ON to flip the "TARGET BIT". "FLIP BIT" goes ON for no more time than it takes to scan the next two Rungs. And possibly, for as little time as it takes to scan the next one Rung.
SET-ting "WAS PB" prevents "FLIP BIT" from being re-activated, in subsequent scans, while the PB is still being pressed.
If the PB is just-now pressed, and the "TARGET BIT" is ON, then "TARGET BIT" is RESET (Turned OFF). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). If "FLIP BIT" is turned OFF in this Rung, then the next Rung is prevented from operating on the "TARGET BIT".
If the PB is just-now pressed, and "FLIP BIT" is still ON (not RESET in the previous Rung), and "TARGET BIT" is OFF, then "TARGET BIT" is SET (Turned ON). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). Since "WAS PB" was SET (Turned ON), Rung-1 is prevented from being activated.
When the signal from PB finally goes OFF, after having been ON ("WAS PB" is ON), then run that pair of conditions through a short-termed Timer (1-second). After timeout, RESET (Turn OFF) "WAS PB". That produces a "debouncing" effect. When "WAS PB" goes OFF, the first Rung is allowed to "watch" for the next pressing of PB.
.
This will work in ANY PLC. It is the "generic" solution for any PLC. It's only four Rungs in length and is totally transparent, to ANY PLC user, even Bubba! (OSR's can be confusing to some.)
The Flipping (Toggling) action takes place in only one scan.
This Rung watches for the PB to be pressed. When the PB transitions from NOT Pressed (OFF) to Pressed (ON), "FLIP-BIT" goes ON to flip the "TARGET BIT". "FLIP BIT" goes ON for no more time than it takes to scan the next two Rungs. And possibly, for as little time as it takes to scan the next one Rung.
SET-ting "WAS PB" prevents "FLIP BIT" from being re-activated, in subsequent scans, while the PB is still being pressed.
WAS
PB PB
---| |-------|/|---+---( ) FLIP-BIT
|
+---(SET) WAS PB
If the PB is just-now pressed, and the "TARGET BIT" is ON, then "TARGET BIT" is RESET (Turned OFF). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). If "FLIP BIT" is turned OFF in this Rung, then the next Rung is prevented from operating on the "TARGET BIT".
FLIP TARGET
BIT BIT
---| |-------| |---+---(RST) TARGET BIT
|
+---(RST) FLIP-BIT
If the PB is just-now pressed, and "FLIP BIT" is still ON (not RESET in the previous Rung), and "TARGET BIT" is OFF, then "TARGET BIT" is SET (Turned ON). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). Since "WAS PB" was SET (Turned ON), Rung-1 is prevented from being activated.
FLIP TARGET
BIT BIT
---| |-------|/|---+---(SET) FLIP-BIT
|
+---(RST) FLIP-BIT
When the signal from PB finally goes OFF, after having been ON ("WAS PB" is ON), then run that pair of conditions through a short-termed Timer (1-second). After timeout, RESET (Turn OFF) "WAS PB". That produces a "debouncing" effect. When "WAS PB" goes OFF, the first Rung is allowed to "watch" for the next pressing of PB.
WAS
PB PB +---------+
---|/|-------| |----+ TIMER +---(RST) WAS PB
| 1-Sec |
+---------+
.