The short answer
Ladder Logic Fundamentals
Ladder logic is a graphical PLC programming language drawn to resemble relay ladder diagrams. Each rung reads left to right: input conditions on the left, an output on the right. If a continuous path of true conditions exists across the rung, the output energizes. It is defined in IEC 61131-3 as Ladder Diagram (LD) and remains the most widely used language in industrial controls.
Key points
- A rung is true when a continuous logical path exists from the left rail to the output.
- Series contacts are AND. Parallel branches are OR.
- Examine-if-closed tests whether a bit is on; examine-if-open tests whether it is off.
- The seal-in (latching) rung is the single most common pattern in industrial code.
- Readability is a real engineering requirement, because a technician will read this at 2 a.m.
Reading a rung
Two vertical rails frame the program. Power, conceptually, flows from the left rail to the right. A rung is a horizontal path between them containing conditions and an output. If the conditions form an unbroken true path, the output on the right end energizes.
Pump_Call Pump_Fault Pump_Run
|-----] [---------]/[--------------------------( )----|
(examine (examine (output
if closed) if open) coil)
Reads as: if Pump_Call is ON and Pump_Fault is OFF, energize Pump_Run.The instructions you will use constantly
- Examine if closed -] [-
- True when the referenced bit is on. Often called a normally-open contact, which is a description of the drawing, not of the field device.
- Examine if open -]/[-
- True when the referenced bit is off.
- Output coil -( )-
- Sets the bit on when the rung is true and off when it is false. Non-retentive.
- Latch and unlatch -(L)- -(U)-
- Set and reset a bit that holds its state when the rung goes false. Powerful and easy to misuse. Every latch needs a clearly identified unlatch.
- Timers TON / TOF / RTO
- On-delay, off-delay, and retentive timers. TON is by far the most used, for start delays, failure-to-start windows, and debouncing.
- Counters CTU / CTD
- Count up or down on a false-to-true transition. Used for pump starts, batch counts, and retry limits.
- Comparison EQU / GRT / LES / LIM
- Compare values. The backbone of analog logic: level above start setpoint, pressure below alarm limit, and so on.
- Move and math MOV / ADD / SUB / MUL / DIV
- Move and compute values. Scaling arithmetic usually lives here.
- One-shot ONS / OSR
- True for exactly one scan on a false-to-true transition. Essential when you want an action to happen once, not every scan a condition is true.
Series, parallel, and the shape of logic
Contacts in series form a logical AND: every one must be true. Contacts in parallel form a logical OR: any one being true is enough. Almost all industrial logic is built from these two shapes, and the visual layout of a rung is a direct picture of the boolean expression behind it.
Hand_Call Pump_Run
|-----] [----+------------------------------------( )----|
|
Auto_Call |
|-----] [----+
|
Remote_Call
|-----] [----+
Reads as: Hand_Call OR Auto_Call OR Remote_Call energizes Pump_Run.The seal-in rung
This is the pattern you will see in nearly every program ever written. A momentary start button energizes an output, and a contact from that output is placed in parallel with the button so the rung stays true after the button is released. A normally-closed stop condition in series breaks the path.
Start_PB Stop_PB Fault Motor_Run
|-----] [-------]/[--------]/[--------+-------------( )----|
|
Motor_Run |
|-----] [-----------------------------+
Release Start_PB and the Motor_Run contact holds the rung true.
Stop_PB or Fault breaks the path and the output drops.Writing ladder someone else can maintain
- Name tags for what they are, not where they are wired. Pump_1_Run_Cmd survives a rewire; N7:12/3 does not.
- One clear purpose per rung. Long rungs with five branches are impossible to troubleshoot online.
- Comment the intent, not the syntax. "Prevents restart until discharge pressure decays" is useful; "turns on the pump" is not.
- Group logic into routines that match how the plant is organized: one per pump, one per process area.
- Avoid duplicating the same output coil in more than one place. The last rung solved wins, and it will confuse everyone including you.
- Put interlocks in a consistent position so a technician can scan a program and see the conditions at a glance.
When ladder is the wrong choice
Ladder is excellent for discrete interlocking and for logic that technicians must troubleshoot online. It is poor at math-heavy work, string handling, and complex looping. Structured text handles those cleanly. Most mature programs mix them: ladder for the interlocks and device control that maintenance needs to read, structured text for the calculations underneath.
Frequently asked questions
- Is ladder logic still used?
- Yes, heavily. It remains the dominant language in water, wastewater, and most discrete manufacturing, largely because the people who maintain these systems can read it online while the process is running.
- What is the difference between a normally-open contact in the field and in the program?
- A field contact is a physical device state. A program instruction examines a memory bit. If a normally-closed field contact is wired to an input, the input bit is on when the device is at rest. Whether you use examine-if-closed or examine-if-open in the program depends on what you want to detect, and getting it backwards is a very common commissioning error.
- Why does my output flicker?
- Usually because the same output address is written by more than one rung, or because the condition driving it is oscillating around a threshold with no deadband. Search the whole program for duplicate destructive writes to that address first.
- What is a one-shot and when do I need one?
- A one-shot is true for a single scan when its condition transitions from false to true. You need one any time an action should happen once per event rather than continuously: incrementing a counter, sending a message, or capturing a value at the moment something happened.
Related topics
- Interlocks and PermissivesA permissive lets you start. An interlock stops you. Confusing the two produces equipment that either will not run or will not protect itself.
- PermissivesThe conditions that must be true before a device may start: how permissives differ from interlocks and trips, the list a pump or feeder usually needs, coding them so the HMI can say why a start was refused, and the rules for time delays and bypasses.
- Structured TextThe text language of IEC 61131-3: syntax, control structures, how it fits alongside ladder, the conventions that keep it readable for the next person, and the mistakes that make structured text a liability in a plant that troubleshoots online.
- The PLC Scan CycleRead inputs, solve logic, write outputs, housekeeping. Understanding scan order explains most PLC behavior that looks wrong at first glance.
- Function Block DiagramThe graphical data-flow language of IEC 61131-3: how blocks, pins, and wires work, execution order, where FBD beats ladder and structured text, building reusable equipment blocks, and the habits that keep a diagram readable.
- Sequential Function ChartThe IEC 61131-3 language for sequences: steps, transitions, actions and their qualifiers, alternative and simultaneous branches, where it fits in water and wastewater, and the rules that keep a chart from sticking in a step.
Direct contact
Have a controls question?
Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.