The output image: why your coil did not work
A coil sets a bit in memory, not a terminal. Understanding when that memory reaches the real world explains a whole class of bugs.
By the LADX engineering team
Short answer
A coil writes to the output image in memory, not directly to the terminal. The whole image is copied to the physical outputs once, at the end of the scan. Within the program, a coil is visible immediately to any rung solved after it, and only on the next scan to any rung solved before it.
A coil in ladder logic looks like it energises a terminal. It does not. It sets a bit in a block of memory called the output image, and the controller copies that whole block to the physical terminals once, after the entire program has been solved.
Why it works that way
Consistency. If outputs changed the instant each coil solved, a machine would see them arrive in program order, staggered across the scan. Writing them together means every output changes at the same instant, which is what the wiring diagram implies and what the machine expects.
The consequence people trip over
Inside the program, the output image is just memory, and memory is readable immediately. A rung solved after your coil sees the new value. A rung solved before it sees the old one.
That asymmetry is the whole bug class. Two rungs that look independent behave differently depending on which is first, and nothing in the rung itself tells you so.
If a rung works only every other scan, or takes two presses to respond, look at the order before you look at the logic.
How to check it
Put the suspect bit in a trend or a watch table and step the program one scan at a time. A one-scan lag is obvious when you can see individual sweeps and invisible at full speed.
Sources and further reading
- Siemens S7-1500 Cycle and Response Times function manualcache.industry.siemens.com
- Rockwell Logix 5000 I/O and Tag Data manualliterature.rockwellautomation.com
Common questions
- What is the output image table?
- A block of memory holding the intended state of every physical output. Coils write to it during the scan, and the controller copies the whole block to the terminals once the program has finished solving. It exists so that outputs change together rather than flickering as rungs execute.
- Can a coil be read by another rung in the same scan?
- Yes, if that rung comes after it. Rungs solve in order against the same memory, so a later rung sees what an earlier coil just wrote. An earlier rung sees the previous scan's value, because it had already been solved.
Keep reading
- Fundamentals
Logic gates in ladder logic: AND, OR, NOT, NAND, NOR, XOR, XNOR
Every logic gate as a ladder rung with its truth table, why NAND and NOR are drawn the way they are, and how XOR on bits differs from XOR on words.
- Fundamentals
What actually happens in one PLC scan
Read inputs, solve logic, write outputs, repeat. Plus the three details in that sentence that cause most of the bugs beginners write.
- Practice
Learn PLC programming free: a 30-day plan with no hardware
A 30-day plan to learn PLC programming at home for free: ladder fundamentals, four virtual PLC machines, Structured Text and a small project, all in a browser.