Ladder Logic Basics: Contacts, Coils, Timers
Short answer
- Ladder logic is a PLC programming language that looks like a relay wiring diagram, where power flows from a left rail through contacts that act as conditions to a coil on the right that acts as the result.
- A handful of instructions cover most real programs, including normally open and normally closed contacts, output coils, latch and unlatch coils, timers, counters, compares and one-shots.
- A start/stop seal-in rung ties them together: a start contact in parallel with a contact examining the motor output keeps the coil on until the stop contact opens the path.
Ladder logic is the PLC programming language that looks like a relay wiring diagram: power flows from a left rail through contacts that act as conditions, to a coil on the right that acts as the result. If the path is complete, the coil turns on. A handful of instructions cover most real programs.
How do you read a ladder logic rung?
Each rung is one statement. Contacts on the left are questions: is this input on, is this bit set, is this value greater than that one? Coils and instruction blocks on the right are actions. Series contacts behave like AND. Parallel branches behave like OR. That is the whole grammar, and everything else is a refinement of it.
The contact does not have to be wired to a switch. It can examine a physical input, an output, an internal bit or a timer status. This catches beginners who assume a contact symbol means a hardware contact. It means "examine this address".
What are normally open and normally closed contacts?
A normally open (NO) contact passes power when its bit is true, that is, on. A normally closed (NC) contact passes power when its bit is false. The name is about what the instruction tests, not about the wiring of the field device. A stop pushbutton wired with a normally closed physical contact is usually programmed with a normally open examine instruction, because the healthy, unpressed button holds the input on. That surprises people the first time, and it is deliberate: a cut wire reads as a stop.
Which ladder logic instructions are used most often?
| Instruction | Typical symbol | What it does |
|---|---|---|
| Examine on (NO contact) | Two vertical bars | True when the bit is on |
| Examine off (NC contact) | Two bars with a diagonal line | True when the bit is off |
| Output coil | Circle or pair of brackets | Bit on while the rung is true, off when false |
| Latch / set coil | Circle marked L or S | Turns the bit on and keeps it on |
| Unlatch / reset coil | Circle marked U or R | Turns the bit off and keeps it off |
| On-delay timer (TON) | Timer block | Output true after the input has been true for the preset time |
| Off-delay timer (TOF) | Timer block | Output stays true for the preset time after the input goes false |
| Retentive timer (RTO) | Timer block | Accumulates time and keeps it when the input drops, until reset |
| Up counter (CTU) | Counter block | Adds one on each false-to-true transition |
| Down counter (CTD) | Counter block | Subtracts one on each transition |
| Compare (equal, greater, less) | Box with operator | True when the comparison holds |
| One-shot (rising edge) | Contact with an arrow or block | True for exactly one scan on a false-to-true change |
Names and symbols differ between vendors, and IEC 61131-3 gives the standard forms. Some platforms call the same timer by another name, count in different units, or reset timers differently. Read your platform's instruction reference rather than assuming.
How does a start/stop seal-in rung work?
This is the first rung everyone writes, and it explains most of the others. In words: a normally open start pushbutton contact sits in parallel with a normally open contact that examines the motor output itself. In series with both is the stop contact, then an overload-healthy contact, and finally the motor coil.
Press start and the rung becomes true, the coil turns on. Now the parallel contact, which examines the coil's own bit, is also true, so releasing start does not break the path. The rung has sealed itself in. Pressing stop opens the series path, the coil drops out, the seal-in contact opens, and the motor stays off until start is pressed again.
Because the seal-in is part of the rung, it has a useful behaviour: after a power loss, the motor does not restart by itself. The bit is clear when the controller powers up. Whether that is what you want matters for safety and for the process, and the answer belongs to whoever designs the machine, not to the programmer's habit.
Should you use a latch or a seal-in?
A latch coil sets a bit and holds it, and a separate unlatch coil clears it. It looks neater than a seal-in rung but behaves differently in one important way: most controllers retain latched bits through a power cycle or a mode change unless configured otherwise. A seal-in rung forgets, because the rung re-evaluates from scratch. Latch instructions are right for alarms that must stay until acknowledged and for remembered states. They are risky for motor start logic, where an unexpected restart after power returns is the hazard.
Also watch for a latch and unlatch of the same bit both being true in one scan. Whichever rung is lower in the program wins.
How do timers and counters work in practice?
- Preset and accumulated values. A timer counts toward a preset. The done bit goes true when the accumulated value reaches it. The timing base, whether milliseconds or seconds, is set by the platform or the timer type.
- Resetting. A basic on-delay timer resets when its input goes false. A retentive timer and a counter need an explicit reset instruction, and forgetting it is the classic cause of a count that never clears.
- Counters count edges, not time. A counter rung that stays true across many scans still counts once. Counters that appear to count several times per event usually have a rung with no one-shot ahead of it, or a worn sensor that bounces.
What do compares and one-shots do?
Compare instructions test values: a tank level above a setpoint, a temperature below a limit. For analog values, add a small deadband so the output does not chatter on and off around the setpoint. A one-shot turns a held condition into a single-scan pulse, which is what you want when something should happen once per event, such as incrementing a counter or logging a fault.
What are common ladder logic questions?
Why does my NC pushbutton use an NO instruction?
Because the instruction examines the input state, not the device. A healthy normally closed stop button keeps its input on, so the program looks for "on" to allow running.
Is ladder logic the only PLC language?
No. IEC 61131-3 also defines function block diagram, structured text, sequential function chart and instruction list. Ladder remains common because maintenance staff can read it like a schematic.
When should I use a latch instead of a seal-in?
Use a latch when a state must survive and be cleared deliberately, such as an alarm. Use a seal-in for running motors, where an automatic restart after power returns could be unsafe.
Why does a timer not time?
Check that its rung is actually true, that the preset is non-zero, and that nothing else resets it. Also confirm the routine containing it is being called.
Further reading on this site: learning PLC programming; what a PLC is; timer relay functions; how motor starters work; the PLC scan cycle.
If you are replacing a controller or relay-based panel and want help finding an equivalent, send us the existing details and we will help match it.
Need a quote on a specific part?
Request a QuoteFrequently asked questions
What is the difference between a latch and a seal-in in ladder logic?
A latch coil sets a bit and holds it until a separate unlatch coil clears it, and most controllers retain latched bits through a power cycle or mode change. A seal-in rung forgets, because the rung re-evaluates from scratch. Latches suit alarms that must stay until acknowledged, while seal-ins suit motor start logic.
Why does a normally closed stop button use a normally open instruction?
The instruction examines the input state, not the device. A healthy, unpressed normally closed stop button holds its input on, so the program looks for on to allow running. The name describes what the instruction tests, not the wiring of the field device. This is deliberate, because a cut wire reads as a stop.
Why does my PLC timer not time?
Check that its rung is actually true, that the preset is non-zero, and that nothing else resets it. Also confirm the routine containing the timer is being called. A basic on-delay timer resets when its input goes false, while a retentive timer and a counter need an explicit reset instruction.
Why does a counter count more than once per event?
Counters count edges, not time, so a rung that stays true across many scans still counts once. A counter that appears to count several times per event usually has a rung with no one-shot ahead of it, or a worn sensor that bounces. A one-shot turns a held condition into a single-scan pulse.
Industrial Automation & MRO Parts