Skip to content
EDWartens UK
Physical AIUpdated 21 October 20269 min read

Ladder Logic Tutorial for Beginners: Worked Examples (2026)

Ladder logic is the graphical PLC language in IEC 61131-3, drawn as rungs between two power rails. This tutorial explains contacts, coils, timers and counters, then builds a start/stop motor circuit with a seal-in and a two-timer flasher, with the logic written out in plain text.

Ladder LogicPLC TutorialBeginnersIEC 61131-3SiemensAllen-Bradley
Ladder Logic Tutorial for Beginners: Worked Examples (2026)

Key takeaways

  • Ladder Diagram is one of the IEC 61131-3 languages; rungs are evaluated top to bottom, left to right, within each scan cycle.
  • A start/stop circuit is Motor_Run = (Start_PB OR Motor_Run) AND Stop_PB, where the Motor_Run contact is the seal-in.
  • A physically normally closed stop button reads 1 when healthy, so it is programmed with an examine-if-true contact; a broken wire then stops the motor.
  • Two on-delay timers (TON), each with a 2 second preset and restarting each other, make a 2 s on / 2 s off flasher.
  • A CTU counter counts rising edges only, so a part sitting in front of the sensor is counted once.

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.

A simple ladder logic example showing rungs between two power rails
A simple ladder logic example showing rungs between two power railsPhoto: Hugh Jack, CC BY-SA 3.0, via Wikimedia Commons
What is Ladder Logic?

What are the basic building blocks?

ElementSymbol ideaMeaning
Normally open contact (examine if true)two vertical barsPasses power when its bit is TRUE
Normally closed contact (examine if false)bars with a slashPasses power when its bit is FALSE
Output coilround bracketsWrites the rung result to a bit
Set / reset coilsS and R in bracketsLatch an output on or off until the opposite instruction runs
TON timerblockOn-delay: output after input has been true for the preset time
TOF timerblockOff-delay: output stays on for the preset time after input goes false
CTU / CTD counterblockCounts 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:

  1. 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.
  2. Press Start: Start_PB reads 1, the rung is true, Motor_Run becomes 1.
  3. Release Start: Motor_Run is now 1, so the parallel seal-in contact keeps the rung true.
  4. 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?

  1. Use descriptive tag names such as Conveyor1_Run rather than raw addresses like I0.0 or Q0.0.
  2. Comment each network with its purpose, not just its mechanics.
  3. Write each output once. Driving the same coil from several rungs gives the last rung priority and confuses fault finding.
  4. Keep safety and normal logic separate, as noted above.
  5. Simulate before downloading to a live machine. TIA Portal with PLCSIM and Factory I/O are common choices; there are free browser tools too.
  6. 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.

Start free

Learn Allen-Bradley PLCs free, then practise the job

Free job simulation

PLC Programmer

Write the I/O list, program the line, run the FAT and handle a change request.

The first five days are free, no card needed.

Live UK jobs

PLC and automation jobs in the UK

Updated daily, with licensed visa sponsors marked.

Browse all engineering jobs

Frequently asked questions

What is ladder logic in PLC programming?

Ladder logic, or Ladder Diagram, is a graphical PLC language standardised in IEC 61131-3. Programs are drawn as rungs between two power rails: contacts on the left test conditions and coils on the right set outputs. It was modelled on relay wiring diagrams, so electricians and maintenance staff can read it easily.

What is a seal-in contact in ladder logic?

A seal-in, or latching, contact is the output's own contact placed in parallel with the start button. Once the output turns on, its contact keeps the rung true after the start button is released. Pressing the stop button, which opens the series stop contact, breaks the rung and releases the seal-in.

Should a stop button be normally open or normally closed?

Wire stop buttons normally closed. If a wire breaks or a terminal loosens, the input drops to 0 and the machine stops, which is fail-safe. In the program, that healthy input reads 1, so you use an examine-if-true contact. Emergency stops still need dedicated safety-rated hardware and logic, not ordinary program logic.

What is the difference between TON and TOF timers?

A TON (on-delay) timer turns its output on after its input has been true for the preset time. A TOF (off-delay) timer turns its output on immediately when the input goes true, then holds it on for the preset time after the input goes false. Both follow the IEC 61131-3 timer block pattern.

Is ladder logic enough to get a PLC job?

Ladder logic is the usual foundation and is widely used for discrete control, but employers also expect you to read other IEC 61131-3 languages such as structured text, understand sensors and wiring, and work with HMI and SCADA. A portfolio of tested simulated projects helps show competence.

Sources

  1. IEC webstore: IEC 61131-3:2013 Programmable controllers, programming languages
  2. Wikipedia: IEC 61131-3
  3. PLCopen: IEC 61131-3 standard
  4. Wikipedia: Programmable logic controller

Share this article

About the author

EDWartens Team

EDWartens Instructional Team

The EDWartens instructional team brings together UK-based automation engineers, certified Siemens and Rockwell specialists, and industry practitioners with decades of combined experience in PLC programming, SCADA engineering, and industrial AI.

View all articles by EDWartens

Ready to become job-ready?

Start with a free course today, or train live in Siemens PLC, HMI and SCADA on the Professional Module.

Related articles

LinkedIn Profile Tips for PLC and Automation Engineers
Career

LinkedIn Profile Tips for PLC and Automation Engineers

To get found by recruiters on LinkedIn, write a headline with your role and platforms, back every skill with a project or certificate, and use the Open to Work setting that fits your situation. Siemens is named in 11.8% and Rockwell in 5.6% of UK PLC engineer adverts (ITJobsWatch, October 2026), so those terms belong on your profile.

Read article
What Is a PLC and Why Learn It? A UK Guide (2026)
Physical AI

What Is a PLC and Why Learn It? A UK Guide (2026)

A PLC (programmable logic controller) is a ruggedised industrial computer that reads sensors, runs a stored program in a repeating scan, and switches motors, valves and lights. UK permanent PLC Engineer adverts quoted a median of £60,000 in the six months to 21 October 2026, according to ITJobsWatch.

Read article
PLC Programming Languages: LD, FBD, ST and SFC Explained
Physical AI

PLC Programming Languages: LD, FBD, ST and SFC Explained

IEC 61131-3 defines four current PLC programming languages: ladder diagram, function block diagram, structured text and sequential function chart. Instruction list was deprecated in 2013. In the six months to 21 October 2026, ITJobsWatch counted 67 UK permanent adverts citing ladder logic, up from 22 a year earlier.

Read article
Siemens TIA Portal for Beginners: Your First PLC Project
Physical AI

Siemens TIA Portal for Beginners: Your First PLC Project

TIA Portal is Siemens' single engineering environment for programming S7 PLCs, HMIs and drives. To start, install it, add an S7-1200 or S7-1500 CPU, write a start-stop rung in the Main [OB1] block and test it in a simulator. UK PLC Engineer adverts quoted a median of £60,000 in the six months to 21 October 2026 (ITJobsWatch).

Read article