PLC Simulator
140 source-catalogued practice records

Ladder Logic Examples — 8 Canonical Patterns, All Runnable

Learn eight recurring ladder patterns with circuit diagrams, physical-machine context and links into 140 source-catalogued practice records. Then build a first contact-and-coil program in your browser without an account.

Join 6500+ learners practicing PLC programming

The guided first rung needs no account. Create a free account to save progress to start.

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

See this exact skill in the working simulator.

Watch the real browser product respond to the task on this page, then try the same practical workflow yourself. No slides, concept mockups, install, or credit card.

Try this in the browser
PLC Ladder Logic Simulator — Real Rung Editor Walkthrough

Connect each rung to the machine

Six ladder patterns in real control context

A rung is useful only when you can explain the equipment state it creates. These examples connect the abstract contact-and-coil shapes to motors, sensors, sequence timing, permissives and process stages.

Motor seal-in ladder logic example beside start and stop pushbuttons, contactor, overload relay and training motor
01A seal-in rung turns a momentary START command into a maintained motor command while STOP or overload breaks the path.
Forward reverse motor control training panel with two mechanically interlocked contactors and direction pushbuttons
02Forward/reverse control needs logical and physical interlocking so opposing contactors cannot energise together.
Photoelectric sensor counting cartons on a conveyor with a PLC one-shot pulse shown on a programming laptop
03A one-shot converts the sensor transition into one scan of truth, preventing a carton from being counted on every scan it blocks the beam.
PLC timer cascade example sequencing red amber and green traffic lights across three timed stages
04A timed sequence connects each stage condition to the next transition; outputs must remain mutually consistent as the cycle advances.
Technician checking emergency stop, guard switch, overload and pressure permissives before starting a guarded conveyor
05A permissive chain expresses “all conditions healthy,” but safety-rated functions still require suitable hardware and validated design.
PLC state machine example coordinating fill, mix, heat, drain and clean stages on a process training rig
06A state machine makes one operating stage explicit and advances only when the current stage exit conditions are satisfied.

Why patterns matter

Every PLC program is assembled from patterns

A motor start/stop circuit is not invented from scratch each time: the seal-in rung is a recognisable control pattern. An interlock blocking two contactors from energising simultaneously is another. A timer cascade advancing a timed sequence step by step is another. Pattern recognition helps you form a hypothesis about unfamiliar code, but you still verify tag meaning, scan order, hardware state and the machine specification.

These patterns cover common building blocks in discrete machine control. Learning them is not about memorising rungs: it is about understanding what problem each pattern solves, what assumptions it makes and how you would prove the resulting behavior.

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.

Anatomy of a ladder logic example rung — input contacts in series and parallel on the left feeding an output coil on the right, with power evaluated left to right between the two railsA basic ladder logic rung between two power rails: an examine-if-closed contact (XIC) in series driving an output coil (OTE).L1L2] [StartXIC I:0/0LampOTE O:0/0
Before the patterns: every ladder example is one or more rungs — contacts on the left, a coil on the right, power flowing rail to rail.

Direct answers

What ladder logic is—and what it is not

What is ladder logic?

Ladder logic is a graphical PLC programming language. Each rung evaluates conditions on the left and drives instructions or outputs toward the right during the controller scan.

What is a ladder diagram?

A ladder diagram uses two vertical rails with horizontal rungs. Electrical relay diagrams describe wired control; PLC ladder diagrams use similar notation to express software instructions evaluated by a controller.

Relay logic vs PLC ladder logic

Relay logic changes behavior by rewiring components. PLC ladder logic changes software while field devices remain mapped to I/O. PLCs add timers, counters, data and diagnostics, but the electrical safety circuit still has its own requirements.

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

Runnable behavior teaches what a static screenshot cannot

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.

Run the first guided rung without an account, then use a free account to save progress and continue into the catalog.

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.

140 source-catalogued practice records. Built for browser practice.

No install or vendor license is needed to start. Build the first rung without an account.

PLC code and example path

Move from one instruction to a tested control pattern

Read the instruction behavior, inspect a complete pattern, run its edge cases and then adapt it as a project.