Ladder Logic Examples: 25 Programs Explained

Ladder logic is still the most widely used PLC programming language on the plant floor, and the fastest way to learn it isn’t by memorizing instruction sets.

It’s by studying real rungs that solve real problems. Below are 25 ladder logic examples that cover the patterns you’ll actually use in the field, from a simple AND gate to multi-step sequencers, organized by category so you can jump to what you need.

Each example includes a plain-text rung diagram, the logic explained line by line, and where you’d realistically deploy it on a machine.

These are written for Allen-Bradley/Rockwell-style ladder (RSLogix 5000/Studio 5000) conventions, but the logic translates directly to Siemens TIA Portal, CODESYS, and any IEC 61131-3 compliant platform. Only the tag syntax changes.

Basic Logic Gates

AND Logic (Series Contacts)

|--[ ]---------------------[ ]----------------( )--|
|  Sensor_A   Sensor_B         Output |

Two normally-open contacts wired in series only pass power to the output coil when both conditions are true.

This is the ladder logic equivalent of a Boolean AND gate. A common real-world use is requiring a part-present sensor AND a clamp-closed sensor before allowing a press cycle to start.

OR Logic (Parallel Contacts)

|--[ ]------------------------------( )--|
|  Sensor_A                Output |
|--[ ]----------------------------------|
|  Sensor_B                       |

Contacts in parallel form an OR condition. Either branch energizes the coil. A typical application is allowing a pump to run if either a local start button or a remote SCADA start command is active.

NOT Logic (Normally Closed Contact)

|--[/]-------------------------------( )--|
|  Fault_Bit                 Run_OK  |

A normally-closed contact (shown as [/]) is true when the referenced bit is false. This inverts logic without needing a separate NOT instruction.

If Fault_Bit is off, Run_OK energizes. Used constantly for permissive conditions like “no fault present.”

Combined AND/OR Logic

|--[ ]--[ ]-------------------------( )--|
|  A     B                       Output |
|--[ ]-----------------------------------|
|  C                                    |

This rung reads as (A AND B) OR C. Combined logic like this is how you build real permissive chains, for example, “Guard closed AND E-stop clear, OR maintenance override active.”

Start/Stop and Motor Control

Basic Seal-In (Latching) Circuit

|--[ ]------[/]----------------------( )--|
| Start      Stop              Motor  |
|--[ ]------------------------------|      |
| Motor                                |

This is the single most important pattern in ladder logic. Pressing Start energizes Motor, and the parallel Motor contact “seals in” the rung so the output stays on after the start button is released.

The normally closed Stop contact breaks the circuit when pressed. Every start/stop station on every machine you’ll ever work on is a variation of this rung.

Motor Start/Stop with Overload Protection

|--[ ]---------[/]------[/]------------( )--|
| Start      Stop     OL           Motor |
|--[ ]------------------------------|      |
| Motor                                   |

Identical to the seal-in circuit but with a normally closed overload relay contact (OL) added in series.

If the motor draws excessive current, the overload trips, its contact opens, and the motor de-energizes regardless of the seal-in state, a critical protection layer for any motor circuit.

Jog Control

|--[ ]----------[/]--------------------( )--|
| Start      Stop                 Motor |
|--[ ]-------[/]--------------------------|      |
| Motor  Jog                             |
|----[ ]--------------------------------( )--|
| Jog_PB                            Motor |

Jog logic lets an operator run a motor only while holding a pushbutton, without a full seal-in. The Jog contact blocks the normal seal-in branch while jogging so the motor doesn’t latch on, while a separate rung drives the motor directly from Jog_PB.

Forward/Reverse with Electrical Interlock

|--[ ]---------[/]--------[/]-------[/]------------( )--|
| Fwd_PB Stop  Rev_Aux  OL      Fwd_Cont |
|--[ ]------------------------------|
| Fwd_Cont                              |

|--[ ]---------[/]------[/]-----------[/]------------( )--|
| Rev_PB Stop  Fwd_Aux  OL      Rev_Cont |
|--[ ]------------------------------|
| Rev_Cont                              |

Each direction’s rung includes a normally closed auxiliary contact from the opposite contactor.

This prevents both contactors from ever being energized simultaneously, which would short two phases together.

This is a textbook interlock pattern and one of the most commonly tested concepts in industrial electrician and controls certifications.

Interlocking Two Independent Motors

|--[ ]------------[/]------------------------( )--|
| Start1  M2_Running              Motor1 |
|-----[ ]--------------------------------|
| Motor1                                   |

Used when two machines physically can’t run at the same time — for example, two augers feeding the same hopper. Motor1 can only start if Motor2 isn’t already running, and vice versa on the paired rung.

Timers

On-Delay Timer (TON)

|--[ ]--------------------[TON]------|
| Sensor              Timer1        |
|                       PT: 5000ms  |

|--[ ]--------------------------------( )--|
| Timer1.DN                Output  |

A TON starts counting the moment it Sensor goes true and sets its .DN (done) bit after the preset time elapses.

If Sensor drops before the preset, the timer resets. Classic use: delaying a conveyor start 5 seconds after an upstream sensor triggers, to let product clear a transition point.

Off-Delay Timer (TOF)

|--[ ]--------------------[TOF]------|
| Sensor              Timer2        |
|                       PT: 3000ms  |

|-------[ ]----------------------------( )--|
| Timer2.DN                Fan_Run |

A TOF’s output stays true immediately when the input goes true but delays turning off after the input drops.

It’s commonly used to keep an exhaust fan running for a set period after a process stops to finish clearing fumes.

Retentive Timer (RTO)

An RTO accumulates time only while its input is true, but unlike a TON, it does not reset when the input goes false.

It only resets on an explicit reset instruction. This is used for tracking cumulative run time toward a maintenance interval, such as “alert after 500 total hours of pump operation,” even across multiple start/stop cycles.

Timer Cascade (Sequential Delays)

|--[ ]----[TON T1: 2s]--|--[T1.DN]----[TON T2: 3s]--|
| Start                                                |

|--[T2.DN]------------------------------------( )--|
|                                          Valve_Open |

Chaining timers so one’s .DN bit triggers the next is how you build multi-step delay sequences without a full sequencer, useful for staggered equipment starts (start pump 1, wait 2 seconds, start pump 2, wait 3 seconds, open valve) to avoid inrush current spikes across a facility.

Counters

Up Counter (CTU)

|---------[ ]------------------[CTU]------|
| Part_Sensor          Counter1     |
|                                  PRE: 100    |

|-------------[ ]------------------------( )--|
| Counter1.DN            Batch_Full |

Increments Counter1.ACC by 1 each time Part_Sensor transitions from false to true. When the accumulated count reaches the preset (PRE), .DN sets. Used for batch counting, box counting on a case packer, or cycle counting on a press.

Down Counter (CTD) with Reset

|------[ ]-----------------------[CTD]------|
| Part_Removed         Counter2     |

|--------[ ]------------------------------( )--|
| Reset_PB              Counter2.RES |

Counts down from a preset toward zero, common for inventory tracking (parts remaining in a bin) or countdown-to-empty displays. The reset rung clears the accumulator back to zero on demand.

Counter-Based Alternator (Toggle Every N Cycles)

Combining a counter with a compare or a modulo instruction lets you alternate between two outputs every N cycles, for example, alternating fill between two identical tanks every 10 batches to balance wear on valves and pumps.

Sequencing and Process Control

Conveyor Sequence Start (Cascading Motor Start)

|-------[ ]-----------[/]------------------( )--|
| Start_PB   Stop_PB           Conv3  |
|-------[ ]-------------------------------------|
|      Conv3                                         |

|--[ ]--[TON 2s].DN------------( )--|
| Conv3                          Conv2  |

|--[ ]--[TON 2s].DN------------( )--|
| Conv2                          Conv1  |

Multi-conveyor lines start from the discharge end backward so the product is never fed onto a stopped conveyor.

Each downstream conveyor’s running status, delayed slightly, permits the next one upstream to start. This pattern is standard on packaging and bulk material handling lines.

Tank Level Control with Hysteresis (Fill/Empty Deadband)

|--[ ]--------[/]------------------------( )--|
| LSL      LSH                 Fill_Pump |
|------[ ]------------------------------|
| Fill_Pump                              |

Using a low-level switch (LSL) to start filling and a high-level switch (LSH) to stop, with the seal-in pattern, prevents the pump from rapidly cycling on and off right at a single setpoint.

This deadband/hysteresis approach is fundamental to any level, pressure, or temperature control loop built from discrete switches rather than a PID loop.

Alarm Annunciator with Acknowledge and Reset

|--------[ ]---------[/]-----------------------( )------|
| Fault_In    Ack_PB              Alarm_Latch |
|---------[ ]------------------------------|
| Alarm_Latch                              |

|---------[ ]--------------------------( )--|
| Alarm_Latch                   Horn |

The fault condition latches an alarm bit even after the field condition clears, so operators can’t miss a momentary fault.

An acknowledge pushbutton silences the horn without clearing the underlying latch, and a separate reset (often requiring the fault to be physically clear first) unlatches it. This is the backbone of every SCADA/HMI alarm system.

First-Out (First Fault) Detection

When several faults could occur nearly simultaneously, a first-out circuit uses a single “any fault already latched” bit to block subsequent faults from overwriting which one tripped first:

|------[/]----------[ ]------------------------( )--|
| AnyFault  Fault_A            FirstOut_A |
|-----[/]-------------[ ]------------------------( )--|
| AnyFault  Fault_B               FirstOut_B |

Only the fault that occurs while AnyFault is still false gets to latch its own first-out bit, which is exactly what maintenance techs need to diagnose the true root cause instead of a cascade of downstream trips.

Selector Switch Mode Logic (Manual/Auto)

|-------[ ]-----------[ ]------------------------( )--|
| Auto_SS  Auto_Cond              Motor  |
|--------[ ]----------[ ]------------------------|
| Man_SS   Man_PB                           |

A three-position or two-position selector switch bit routes control between an automatic permissive chain and a manual pushbutton branch.

This pattern appears on nearly every piece of standalone equipment that needs both automated operation and maintenance override.

Safety Circuits

Emergency Stop (Hardwired + Ladder Confirmation)

|---------[ ]---------------------------( )-----------|
| EStop_Chain_OK       Master_Enable |

While true E-stop circuits are hardwired through safety relays independent of the PLC, ladder logic still reads the safety relay’s confirmation output (EStop_Chain_OK) as a permissive for every motion and motor-start rung in the program.

Never rely on ladder logic alone to satisfy a safety-rated stop function. This rung is a software layer permissive on top of hardwired safety, not a replacement for it.

Two-Hand Anti-Tie-Down Control

|----[ ]----------[ ]---------------[TON 0.5s].DN----------( )--|
| RH_PB    LH_PB                  Press_Cycle |

Requires both palm buttons pressed within a short time window of each other (enforced by the timer) before a press cycle is permitted, and both must be actively held.

This prevents an operator from taping one button down and defeating the two-hand safety intent.

Anti-tie-down logic like this is often required by machine safety standards for point-of-operation guarding.

Analog and Data Handling

Analog Compare (High/Low Setpoint Alarm)

|------[GRT]---------------------------------( )--------------|
| Tank_Temp > 180.0          High_Temp_Alarm |
|------[LES]----------------------------------( )--------------|
| Tank_Temp < 32.0            Low_Temp_Alarm  |

Compare instructions (GRT, LES, EQU, etc.) work directly on analog values scaled from 4–20 mA or RTD inputs rather than discrete sensor bits.

This is how ladder logic bridges into process control, reading a live temperature, pressure, or flow value and triggering discrete alarm or interlock bits from it.

Sequencer / Step-Based State Machine

Step 0: |--[ ]--------------------( MOV 1 )--|
        | Start_PB                   Step_Reg   |

Step 1: |--[EQU Step_Reg 1]--[Cond_A]--( MOV 2 )--|
                                          Step_Reg

Step 2: |--[EQU Step_Reg 2]--[Cond_B]--( MOV 3 )--|
                                          Step_Reg

For machines with more than a handful of sequential operations, a step register (an integer tag moved forward as each condition is met) is cleaner and far more maintainable than chaining dozens of seal-in rungs.

Each rung only fires when Step_Reg equals its assigned step number and moves the register to the next step once its condition is satisfied.

This is the ladder logic precursor to a full state machine and scales to sequences with dozens of steps; batch processes, multi-axis machine cycles, and CIP (clean-in-place) routines are almost always built this way.

Frequently Asked Questions

What’s the difference between ladder logic and a wiring diagram?

A wiring diagram shows physical electrical connections between real devices. Ladder logic is a program that runs inside the PLC and only represents relay logic visually.

The “contacts” and “coils” are memory bits and instructions, not physical wires, even though the layout deliberately mirrors old relay control panels for readability.

Why does ladder logic still use relay-style symbols if PLCs aren’t relays?

Ladder logic was designed in the 1970s specifically so electricians who already understood relay control panels could transition to PLCs without learning a new paradigm from scratch.

The symbolic convention stuck because it’s genuinely intuitive for describing discrete on/off control, even decades after the underlying hardware changed completely.

Can these examples run on any PLC brand?

The underlying logic is portable across brands, but instruction names and syntax vary. Allen-Bradley uses TON/TOF/CTU/CTD; Siemens uses S_ODT/S_OFFDT or the IEC timer blocks TON/TOF in TIA Portal; other platforms vary similarly.

The logic pattern, what triggers what and in what order is what transfers, not the exact syntax.

What’s the best way to practice these before touching a real PLC?

Most of these examples can be built and tested in a free simulator (RSLogix Emulate, CODESYS simulation mode, or an open-source ladder logic simulator) before ever touching live hardware, which is the safest way to build muscle memory for I/O addressing and rung logic.

Do I need to memorize instruction sets to write ladder logic well?

No, memorizing every instruction matters far less than understanding the handful of patterns above.

Once seal-in, interlocking, timer, counter, and sequencer logic are second nature, reading and writing almost any industrial ladder program becomes a matter of recognizing which pattern (or combination of patterns) is in front of you.

2 thoughts on “Ladder Logic Examples: 25 Programs Explained

  1. Pingback: Structured Text Examples For PLC Programming: 20 Real-World Programs Explained - controlcircuitry.com

  2. Pingback: DCS vs PLC vs SCADA Explained: Key Differences, Use Cases, and How They Work Together

Leave a Reply

Your email address will not be published. Required fields are marked *