Ladder logic (Ladder Diagram, LD) is the graphical PLC language defined in IEC 61131-3. A program is drawn as rungs between two vertical power rails; if the conditions on the left of a rung are true, the output on the right is energised. It was designed to look like relay wiring diagrams so that electricians and maintenance staff could read it, and it remains the most common language for discrete machine logic.
What is ladder logic and how is a rung evaluated?
A rung is a logical statement: inputs (contacts) on the left, outputs (coils) on the right. The PLC evaluates rungs from top to bottom and left to right inside each scan cycle: read inputs, execute the program, write outputs. IEC 61131-3 itself lists Ladder Diagram alongside Function Block Diagram, Structured Text and Sequential Function Chart; the 2013 edition of the standard also included Instruction List, which Wikipedia notes was deprecated in that edition.

What are the basic building blocks?
| Element | Symbol idea | Meaning |
|---|---|---|
| Normally open contact (examine if true) | two vertical bars | Passes power when its bit is TRUE |
| Normally closed contact (examine if false) | bars with a slash | Passes power when its bit is FALSE |
| Output coil | round brackets | Writes the rung result to a bit |
| Set / reset coils | S and R in brackets | Latch an output on or off until the opposite instruction runs |
| TON timer | block | On-delay: output after input has been true for the preset time |
| TOF timer | block | Off-delay: output stays on for the preset time after input goes false |
| CTU / CTD counter | block | Counts rising edges up or down to a preset value |
An important point for beginners: the contact symbol describes how the program reads a bit, not the physical wiring. A contact that is "normally open" in the program passes power when its bit is 1. What the bit means depends on how the device is wired, as the example below shows.
IEC 61131-3 defines standard timer function blocks with inputs IN (start) and PT (preset time) and outputs Q (done) and ET (elapsed time). Counter blocks such as CTU have CU (count up), R (reset), PV (preset value), Q and CV (current value). Different vendors add variants, so check your CPU's documentation.
Example 1: how do you write a motor start/stop circuit?
The classic start/stop circuit uses a seal-in (latching) contact. Tags: Start_PB (input, wired normally open), Stop_PB (input, wired normally closed), Motor_Run (output to the contactor).
Rung 1, in plain text:
- Branch A: Start_PB contact, in parallel with Branch B: Motor_Run contact (the seal-in).
- In series with the branches: Stop_PB contact.
- Output: coil Motor_Run.
Written as a Boolean expression: Motor_Run = (Start_PB OR Motor_Run) AND Stop_PB.
Walk through it:
- Idle: Stop_PB is wired normally closed, so its input reads 1 and its contact passes power. Start_PB reads 0, so Motor_Run stays 0.
- Press Start: Start_PB reads 1, the rung is true, Motor_Run becomes 1.
- Release Start: Motor_Run is now 1, so the parallel seal-in contact keeps the rung true.
- Press Stop: the NC button opens, Stop_PB reads 0, the rung goes false, the motor stops and the seal-in drops out.
Why wire Stop as normally closed? If a wire breaks or the terminal comes loose, the input reads 0 and the motor stops, a fail-safe behaviour. This is also why the stop contact in the program is drawn as an "examine if true" contact. Note this start/stop circuit is not a safety function: emergency stops must be implemented with safety-rated hardware and logic to the relevant machinery safety standards, independent of ordinary program logic. See the free machine safety course.
Example 2: how do you make a 2-second on, 2-second off flasher?
Use two on-delay timers that restart each other. Tags: TON1, TON2 (on-delay timers, preset 2 seconds each) and Lamp (output).
- Rung 1: NOT TON2.Q enables TON1 (IN). TON1 preset time is 2 seconds.
- Rung 2: TON1.Q enables TON2 (IN). TON2 preset time is 2 seconds.
- Rung 3: contact TON1.Q in series with a normally closed contact TON2.Q drives coil Lamp.
Timeline: from 0 to 2 s, TON1 is timing and Lamp is off. At 2 s TON1.Q goes true, Lamp turns on and TON2 starts. At 4 s TON2.Q goes true; this breaks Rung 1, TON1 resets, TON1.Q drops, Lamp turns off and TON2 resets. The cycle restarts. The result is a 2-second off, 2-second on pattern, with a small error of about one scan because the resets propagate scan by scan. Many PLCs also offer a built-in clock memory byte, which is a simpler way to flash a lamp in production code.
Example 3: how do you count parts with a counter?
A CTU counts rising edges of a sensor. Tags: Part_Sensor (input), Batch_Counter (CTU, preset 10), Reset_PB (input), Batch_Full (output).
- Rung 1: Part_Sensor drives the count-up input CU of Batch_Counter, with PV = 10. Reset_PB drives its R input.
- Rung 2: Batch_Counter.Q drives coil Batch_Full.
CTU counts only on a rising edge, so a part that stays in front of the sensor is counted once. When the count reaches 10, Q goes true until Reset_PB is pressed.
What are good ladder logic habits?
- Use descriptive tag names such as Conveyor1_Run rather than raw addresses like I0.0 or Q0.0.
- Comment each network with its purpose, not just its mechanics.
- Write each output once. Driving the same coil from several rungs gives the last rung priority and confuses fault finding.
- Keep safety and normal logic separate, as noted above.
- Simulate before downloading to a live machine. TIA Portal with PLCSIM and Factory I/O are common choices; there are free browser tools too.
- Keep programs modular once they grow beyond a screen. Our programme structure guide shows how.
Common mistakes: forgetting the seal-in, assuming a normally closed physical button needs a normally closed program contact, writing the same output twice, and ignoring scan order (a rung lower in the program sees values changed by rungs above it in the same scan).
Where can you practise ladder logic for free?
The EDWartens lab has a browser ladder logic simulator and PLC simulator that run with no install, plus a motor control simulator for the start/stop example. For a structured walk-through in the vendor tool, try the free Siemens TIA Portal course or, for Rockwell, the free Allen-Bradley Studio 5000 course. For questions after you learn, see 50 PLC interview questions.
Example 4: how do you toggle an output with one button?
A toggle (push-on, push-off) needs edge detection, otherwise the output flips on every scan while the button is held. IEC 61131-3 provides the R_TRIG rising-edge detector for this. In plain text:
- Rung 1: Button feeds an R_TRIG instance named Button_Edge; Button_Edge.Q is TRUE for exactly one scan when the button goes from 0 to 1.
- Rung 2: Lamp = (Button_Edge.Q AND NOT Lamp) OR (Lamp AND NOT Button_Edge.Q).
Each press toggles the lamp once. This is the same logic behind a counter's rising-edge input, and the same reason a held button is counted only once. Edge detection is one of the first techniques beginners should master.
Why does scan order matter in ladder logic?
Because rungs execute in order, a value changed by a rung is seen by every rung below it in the same scan, but rungs above it see the new value only on the next scan. That can create one-scan delays or, worse, outputs that appear to flicker. Two habits avoid most problems: write each output coil once, and organise logic so that decisions are made before the rungs that act on them. Many PLCs also copy inputs into an input image at the start of the scan, so an input that changes mid-scan is not seen until the next one. The same ideas underpin PLC programme structure.
When should you use structured text instead?
Ladder is excellent for interlocks and discrete logic that technicians need to read at a glance, but it becomes awkward for calculations, loops and data handling. Structured Text (ST) is the textual IEC 61131-3 language for those jobs, and Function Block Diagram is common for analogue signal handling and PID. Most real projects mix languages: ladder for permissives and sequences, ST for calculations, FBD for loops. Learn ladder first, then ST once the scan model feels natural. Our PLC languages comparison covers the trade-offs.
How EDWartens can help
The Professional Module takes ladder logic further in a five-day live online class on Siemens TIA Portal (certificate states V17): S7 hardware, ladder logic, simulation and testing, then HMI and WinCC SCADA, followed by 68 self-paced Basic Engineering modules. It is CPD accredited (80 CPD credits, The CPD Group), not a regulated qualification, Siemens-focused and simulation-based rather than a physical rig. £2,140 + VAT (£2,568), £100 deposit option, weekly Monday starts, up to 10 learners. See the course or sign up.




