milldrone said:
XIO,
Remember Ron Beaufort's "big hint", post #12. Things do not happen instantly with a PLC. And they scan the ladder top to bottom. This makes PLC's like a timer. But unlike a timer the "timing" is in sync with the plc.
This should work on your PLC. Can you tell me how it works?
If you put rung #2 first it won't work. Why?
Okay, Milldrone, that took a few minutes to fully understand it. The question's already been answered, but in my words:
1. Upon startup, there is no path from left to right.
2. When you first press the input, Input is on, output is off, and internal is on, giving the input -> !internal -> !output -> output as the path.
3. Internal address goes on while the input is on.
4. While you're holding the input, the path from output -> internal address -> output keeps the light on.
5. When you let go of the input, the output -> not input -> output path is the active path.
6. When you press input again, the output -> input path is broken, turning off output, BUT...
7. During this time, the internal address keeps the light on via the output -> internal -> output path.
8. When you let go, the light turns off.
It won't work when it's backwards because then input and internal are the same value, and you have to have a moment where they are opposite in order to activate the output. This can be done by allowing the scan parameters of the PLC to work in your favour - the first rung is scanned first, then each rung is scanned in order from top to bottom.
Here's my question: Is there a chance that it will fail if the input happens to trigger in between rungs, or does a PLC read the inputs first, before it starts to process the ladder logic?
Ah, my friend Mr. Manual tells me that the PLC I'm using scans its inputs, runs the ladder logic, updates the outputs, does some diagnostics, scans its inputs again, and so on. Ah, so now the "fast IO" makes some sense.