The PLC Bit Turns On, Then Off in the Same Scan: Find the Other Writer
- PLC Play Ground
- 0
- Posted on
A rung can look correct while another instruction writes the same destination later. Online highlighting may not show every intermediate value, especially when tasks run at different rates. Treat a shared output or state bit as a data-ownership question rather than assuming the first visible rung controls it.
Simplified sequential example; task scheduling and I/O updates vary by controller.
What is happening?
Within a simple sequential execution path, later assignments can replace earlier values. Multiple tasks, interrupts, asynchronous I/O, and special instructions complicate that model, so last rung wins is not a universal explanation for every controller. The useful method is to identify every writer and its execution context.
Check these five things
-
Cross-reference the destination, including aliases, structure members, indirect access, and bulk copies that can affect it.
-
List the tasks and routines containing those writes and the conditions under which they execute.
-
Distinguish a request bit from the final output command. Several requests should normally be resolved through a clear ownership rule.
-
Use an approved trace or diagnostic snapshot to compare relevant conditions at the point of assignment.
-
Reproduce the conflict in an isolated test project before consolidating writes or changing execution order.
Worked example
In a teaching routine, one assignment sets RunRequest from an automatic sequence and a later assignment sets the same tag from a false manual button. The final value is false in that simplified sequence. Combining the requests through a reviewed mode-selection rule makes ownership visible.
Quick diagnostic reference
| Search target | Hidden writer example |
|---|---|
| Boolean tag | Another coil or assignment |
| Structure member | Whole-structure copy |
| Output alias | Mapping routine or alternate task |
The mistake to avoid
Moving a rung lower can change the symptom without fixing conflicting ownership. It also makes future edits more fragile.
How to verify the fix
Confirm one documented final writer or an explicitly designed arbitration mechanism. Test all relevant modes and simultaneous requests in simulation.
Field-work boundary: These are educational diagnostic guides. Use the exact equipment manuals and approved site procedures. Electrical testing and machinery changes belong to qualified, authorized personnel; control hazardous energy and validate affected functions before release.
Technical reference
Siemens S7-1200: user-program execution and scan-cycle context. The examples and diagnostic tables above are original teaching material; they do not replace the product manual.
