PLC Simulator
130+ Runnable Examples

Ladder Logic Examples — 8 Canonical Patterns, All Runnable

Every ladder logic program in industry is built from a small set of recurring patterns. This page explains eight of them — with inline pattern diagrams and links to 130+ live browser scenarios where you can run each pattern yourself. No install. No screenshots.

Join 800+ learners practicing PLC programming

First scenarios free. Create a free account to start.

Ladder logic examples — canonical patterns with inline diagrams and runnable scenarios

Why patterns matter

Every PLC program is assembled from patterns

A motor start/stop circuit is not invented from scratch each time — every controls engineer recognises the seal-in rung immediately. An interlock blocking two contactors from energising simultaneously is a known pattern. A timer cascade advancing a timed sequence step by step is a known pattern. When you know the patterns, you read unfamiliar PLC programs quickly because you recognise the structures rather than decoding every rung individually.

The patterns below cover the building blocks of approximately 80% of discrete machine control programs. Learning them is not about memorising rungs — it is about understanding what problem each pattern solves and why it is structured the way it is.

Each pattern on this page includes a structural diagram (pattern shape only — no complete program, no tag addresses), a plain-English explanation of what it does and when it is used, and links to the live scenarios on this platform that exercise that exact pattern. The scenarios are the place to build the pattern yourself. This page is the conceptual foundation.

FoundationalPattern 1 of 8

Seal-In (Motor Latch)

The most common ladder circuit in industry

The pattern

A momentary Start pushbutton energises an output coil. A parallel contact — fed by the same output bit — holds the coil energised after the Start button is released. A normally-closed Stop contact in series with the parallel branch breaks the circuit on demand. The output coil "seals itself in" through its own contact.

When it is used

Virtually every motor circuit. Conveyor drives. Pump contactors. Any load that must stay on after a momentary start command and turn off on a momentary stop command. The pattern also appears in alarm latches, fault holds, and mode-enable circuits where any version of seal-in logic is required.

Practice it in these scenarios

Pattern structure (concept only)

STARTHOLDSTOPMMOTOR
SafetyPattern 2 of 8

Interlock (Mutual Exclusion)

Preventing two outputs from being simultaneously true

The pattern

Two outputs (A and B) must never both be energised at the same time. A normally-closed contact of output A is placed in series with the rung driving output B, and vice versa. If A is true, its NC contact in the B rung opens, blocking B. This is a software interlock; in real panels it is always paired with a hardwired electrical interlock (wired NC contacts across the physical contactors).

When it is used

Forward/reverse motor drives where reversing a spinning motor is mechanically destructive. Star and delta contactors in a star-delta starter — energising both simultaneously would short two motor terminals. Dual-coil solenoid valves where both coils energised is a fault state. Any dual-output exclusion requirement.

Practice it in these scenarios

Pattern structure (concept only)

Rung AFWDREV_NCFWDRung BREVFWD_NCREVNC contacts of each output block the other
Timing & SequencePattern 3 of 8

One-Shot / Edge Detection

Triggering logic on the rising or falling edge of a signal

The pattern

A one-shot (OSR/R_TRIG) instruction produces a single-scan true output on the rising edge of its input signal — regardless of how long the input stays true. A standard normally-open contact stays true for as long as the input is true; the one-shot is true for exactly one scan. The equivalent falling-edge instruction (OSF/F_TRIG) triggers on the 0→1→0 transition.

When it is used

Counting items on a conveyor — a photoelectric sensor sees each item for multiple scans; the one-shot ensures each item counts as exactly one pulse. Incrementing a counter only once per button press even if the button is held. Triggering a timed delay on the first scan that a condition becomes true. Detecting the leading edge of a process alarm before it is acknowledged.

Practice it in these scenarios

Pattern structure (concept only)

Input signalOSR output1 scanSignal stays true; OSR output is true once
Timing & SequencePattern 4 of 8

Timer Cascade (Timed Sequence)

Chaining TON timers to step through a timed sequence

The pattern

Multiple TON (on-delay) timers are chained so that the done bit of timer N enables the coil of timer N+1 and simultaneously de-energises the output for step N. Each step occupies a time window defined by its TON preset. When the final timer's done bit fires, it resets the chain and the sequence repeats from step 1. The done bit of each timer in the chain also drives its corresponding output.

When it is used

Traffic light sequencing — the canonical example. Machine warm-up sequences with timed dwell phases. Wash cycle timers in a CIP or dishwash sequence. Alarm acknowledgement timeout windows. Any application where a series of outputs must each be active for a fixed duration in a repeating cycle.

Practice it in these scenarios

Pattern structure (concept only)

TON T1GREENT1.DNTON T2YELLOWT2.DNTON T3REDT3.DN resets chain → T1 restarts
CountingPattern 5 of 8

Counter Latch (CTU/CTD)

Counting events and triggering logic at a threshold

The pattern

A CTU (count-up) instruction increments its accumulator by one on each rising edge of its count input. When the accumulator reaches the preset value, the done bit goes true. A CTD (count-down) decrements from the preset to zero. The accumulator can be read at any time for display or comparison logic. A reset coil sets the accumulator back to zero.

When it is used

Counting boxes on a conveyor and triggering a diverter or stop signal at the batch size. Counting pump starts for maintenance hour scheduling. Counting parts through a machine cycle to verify correct operation. Tracking occupancy (entry CTU − exit CTU = current count). Any scenario where cumulative events drive a threshold action.

Practice it in these scenarios

Pattern structure (concept only)

CTUPRE = 5ACC = 3COUNTRESET.DN bitACTIONACC increments per rising edge; .DN fires at PRE
FoundationalPattern 6 of 8

SET/RESET Latch

Latching and unlatching a bit with separate coil instructions

The pattern

A SET (latch) coil instruction sets its bit true when its rung goes true and holds it true even when the rung goes false — the bit remains latched until a RESET (unlatch) instruction on a separate rung sets it false. Unlike a seal-in circuit, the SET/RESET latch is controlled by two completely independent rungs. In IEC syntax this is the S and R coil pair; in Allen-Bradley it is OTL (Output Latch) and OTU (Output Unlatch).

When it is used

Fault latch circuits where an alarm state must persist until an operator resets it — even across a power cycle if stored in retentive memory. Mode-select logic where pressing a mode button sets a mode bit and pressing another mode button resets it. Any scenario where set and reset conditions are physically or logically separate enough that combining them in a seal-in rung would be confusing.

Practice it in these scenarios

Pattern structure (concept only)

SET rungTRIGGER(S) SETRESET rungCLEAR(R) RSTSame bit; SET holds even after TRIGGER goes false
SafetyPattern 7 of 8

Safety Permissive Chain

Requiring all safety conditions to be clear before allowing a start

The pattern

A permissive is a condition that must be satisfied before a machine action is allowed. Multiple permissives are wired in series in the logic — each as a normally-closed contact for a fault bit, or a normally-open contact for a ready bit. Every permissive in the chain must be true simultaneously for the permissive rung output to be true. The permissive rung output then gates the start command. A single failed permissive blocks the entire chain.

When it is used

Boiler startup: purge complete AND gas pressure OK AND no flame present must all be true before pilot ignition is permitted. Conveyor start: guard door closed AND e-stop reset AND upstream conveyor running must all be true before the drive can start. Any machine with multiple independent safety or readiness conditions that must all be verified before motion is permitted.

Practice it in these scenarios

Pattern structure (concept only)

DOOR OKESTOP OKPERM CSTARTGOALL permissives must be true → only then can START fire
Timing & SequencePattern 8 of 8

State Machine (Step Sequencer)

Organising complex machine behaviour into named states with defined transitions

The pattern

A state machine assigns an integer step counter (or a set of mutually exclusive state bits) to represent which phase of the machine cycle is currently active. Each rung in the program is conditioned on the current step value. Transition logic advances the step counter when the exit conditions for the current step are met. Only one step is active at a time, and only the rungs for that step execute.

When it is used

Garage door controllers where the door can be Opening, Open, Closing, Closed, or Faulted. Batch mixer sequences where the machine moves through Fill, Mix, Heat, Hold, Drain, and Clean phases. Elevator controllers where the cab can be Idle, Moving Up, Moving Down, Door Opening, Door Open, or Door Closing. Any machine with a defined sequence of named operating modes where the active mode determines what the PLC should be doing.

Practice it in these scenarios

Pattern structure (concept only)

IDLEOPENCLOSEFAULTSTEP integer gates each rung — only active state's rungs execute

Why runnable wins

130+ runnable examples beats every static-screenshot listicle

A screenshot of a ladder diagram explains the structure but not the behaviour. When you run the same circuit in a live simulation and watch the seal-in contact hold the motor on after you release the Start button — or watch the interlock block the reverse contactor when the forward contactor is energised — the pattern shifts from something you recognise to something you understand. That difference is what the grader measures.

Every pattern is immediately runnable

Each pattern on this page links directly to a scenario in the catalogue. Open it in a new tab, write the rung, run it. The grader tests that your circuit behaves correctly under the test inputs — not just that it compiles.

Graded on behaviour, not structure

You can implement a seal-in as a parallel contact or as a SET coil. The grader does not care about the method — it tests whether the output stays true after the start input goes false and goes false when the stop input fires. Correct behaviour is the standard.

Pattern combinations in advanced scenarios

The advanced scenarios combine multiple patterns from this page. The elevator uses seal-in, interlock, state machine, and safety permissive chains together. Recognising the individual patterns inside the larger program is the skill industrial employers test in interviews.

Quick reference

All 8 patterns at a glance

Foundational

Seal-In (Motor Latch)

The most common ladder circuit in industry

Safety

Interlock (Mutual Exclusion)

Preventing two outputs from being simultaneously true

Timing & Sequence

One-Shot / Edge Detection

Triggering logic on the rising or falling edge of a signal

Timing & Sequence

Timer Cascade (Timed Sequence)

Chaining TON timers to step through a timed sequence

Counting

Counter Latch (CTU/CTD)

Counting events and triggering logic at a threshold

Foundational

SET/RESET Latch

Latching and unlatching a bit with separate coil instructions

Safety

Safety Permissive Chain

Requiring all safety conditions to be clear before allowing a start

Timing & Sequence

State Machine (Step Sequencer)

Organising complex machine behaviour into named states with defined transitions

Keep learning

Related resources

Stop reading examples. Start running them.

Every pattern above links to a live scenario. Free account. Browser-based. Real grader.

Questions

Ladder logic examples FAQ

A ladder logic example demonstrates one pattern in isolation — seal-in, one-shot, timer cascade. A full ladder program combines multiple patterns to control a real machine. Learning the patterns individually before combining them is the standard industrial training approach: master the seal-in rung first, then apply it inside a larger conveyor drive program.

130+ examples. Every one runnable in your browser.

No install. No vendor licence. Real scan cycle, real grader. Free to start.