Sitelet https://plcsimulationsoftware.com/ladder-logic-examples
PLC Simulator
170 source-catalogued practice records

Ladder Logic Examples & PLC Ladder Diagrams You Can Run

Ladder logic is a graphical PLC programming language drawn like an electrical ladder diagram: two vertical power rails joined by horizontal rungs of contacts (conditions) and coils (outputs). Every scan, the PLC evaluates each rung left to right, top to bottom, and energizes a coil when a path of true contacts reaches it.

Learn the symbols, read worked rungs step by step, then study eight recurring ladder patterns with circuit diagrams, physical-machine context and links into 170 source-catalogued practice records. Build a first contact-and-coil program in your browser without an account.

Join 13000+ 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 energize 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 recognizable control pattern. An interlock blocking two contactors from energizing 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 memorizing 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. It is the most common first language in PLC programming.

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 running on a programmable logic controller 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.

Read a ladder diagram

Ladder logic symbols you need first

Most PLC ladder diagrams use a small set of symbols. Allen-Bradley and IEC 61131-3 tools draw them slightly differently and use different instruction names, so both are listed. Each symbol refers to a bit or value in memory, not to a physical wire. The full reference, with vendor variations, is on the ladder logic symbols page, and the mnemonics are decoded on the PLC codes reference.

SymbolNameAllen-BradleyIEC 61131-3What it does
--[ ]--Normally open contactXICNO contactTrue when its bit is 1, for example while an input is on.
--[/]--Normally closed contactXIONC contactTrue when its bit is 0. It inverts the bit in logic; it says nothing about how the field device is wired.
--( )--Output coilOTECoilWrites the rung result to its bit every scan: 1 when the rung is true, 0 when it is false.
--(L)-- / --(S)--Latch (set) coilOTLSet coil (S)Sets its bit to 1 when the rung is true and leaves it on after the rung goes false.
--(U)-- / --(R)--Unlatch (reset) coilOTUReset coil (R)Clears its bit to 0 when the rung is true. Pair every latch with a reset path.
--[P]--Rising-edge (one-shot)ONSP contact or R_TRIGTrue for exactly one scan when the condition changes from false to true.
[ TON ]On-delay timerTONTON blockStarts timing when enabled and sets its done output after the preset time.
[ CTU ]Count-up counterCTUCTU blockAdds one on each false-to-true transition and sets its done output at the preset.
[ GRT ] / [ > ]Compare blockGRT, LES, EQUGT, LT, EQPasses power when the comparison of two values is true, such as Level > 80.

Worked examples

How to read a PLC ladder diagram, rung by rung

Every rung is a Boolean expression. Trace power from the left rail: series contacts are AND, parallel branches are OR, and a normally closed contact is NOT. These four small rungs cover the logic that the patterns further down are built from.

Example 1: Contacts in series (AND)

Press = Left_PB AND Right_PB

|--[ Left_PB ]--[ Right_PB ]--------( Press )--|

Power reaches the coil only if every contact in the path is true. This is the logic behind two-hand start; a real two-hand control also needs safety-rated devices and a simultaneity check.

Example 1: Contacts in series (AND) truth table
Left_PBRight_PBPress
000
100
010
111

Example 2: Contacts in parallel (OR)

Alarm = Door1_Open OR Door2_Open

|--+--[ Door1_Open ]--+--------( Alarm )--|
|  |                  |
|  +--[ Door2_Open ]--+

A parallel branch gives power a second path. Either open door is enough to sound the alarm.

Example 2: Contacts in parallel (OR) truth table
Door1_OpenDoor2_OpenAlarm
000
101
011
111

Example 3: Normally closed contact (NOT)

Fill_Valve = NOT High_Level

|--[/ High_Level ]------------------( Fill_Valve )--|

The valve stays open while the high-level switch is off and closes as soon as the tank reaches the high level.

Example 3: Normally closed contact (NOT) truth table
High_LevelFill_Valve
01
10

Example 4: Seal-in, scan by scan

Motor = (Start_PB OR Motor) AND Stop_OK

|--+--[ Start_PB ]--+--[ Stop_OK ]--( Motor )--|
|  |                |
|  +--[ Motor ]-----+

Stop_OK is a normally closed Stop pushbutton, so it is 1 until someone presses Stop (or the wire breaks). The coil feeds its own contact, which holds the rung true after Start is released.

Example 4: Seal-in, scan by scan truth table
ScanStart_PBStop_OKMotor resultWhy
1111Start path is true, so the coil energizes.
2011Start released, but the Motor branch holds the rung true.
3000Stop pressed: the series contact opens the only path.
4010Stop released, but nothing reseals until Start is pressed again.

Rules the PLC follows when it runs ladder logic

  • Rungs are solved left to right and top to bottom, once per scan, using the input values sampled at the start of the scan.
  • A bit changed by one rung is already changed for every rung below it in the same scan, so rung order matters.
  • If two rungs drive the same output coil, the last one solved wins. Use one coil per output, or a deliberate latch/unlatch pair.
  • A normally closed symbol is a logic inversion. A Stop button wired normally closed is usually examined with a normally open contact, because its healthy input is on.

Watch these rules happen live in the PLC scan cycle visualizer, or read the full guide to reading ladder logic.

Run a rung instead of reading one

Build a contact-and-coil rung, flip the input and watch the coil energize. No account or install.

Run your first PLC program — no signup
FoundationalPattern 1 of 8

Seal-In (Motor Latch)

The most common ladder circuit in industry

The pattern

A momentary Start pushbutton energizes an output coil. A parallel contact — fed by the same output bit — holds the coil energized 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 energized 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 — energizing both simultaneously would short two motor terminals. Dual-coil solenoid valves where both coils energized 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 1→0 (true-to-false) 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 scan↑Signal 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-energizes 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)

Organizing complex machine behavior 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 behavior. 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 energized — the pattern shifts from something you recognize 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 catalog. 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 behavior, 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 behavior 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. Recognizing 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)

Organizing complex machine behavior into named states with defined transitions

Keep learning

Related resources

  • What is a programmable logic controller? — how the controller that runs ladder logic reads inputs, solves rungs and writes outputs.
  • PLC programming — a step-by-step path from your first rung to Structured Text and vendor software.
  • PLC codes — instruction mnemonics such as XIC, XIO, OTE, TON and CTU, with code examples.
  • PLC programming examples (blog post) — written explanations with circuit diagrams for selected programs from the catalog.
  • PLC projects — 20 curated browser-runnable projects for students, home practice, and portfolios.
  • Ladder logic symbols — reference guide for every standard IEC and Allen-Bradley ladder symbol.
  • PLC timers — deep dive into TON, TOF, and TP timers across IEC, Allen-Bradley, and Siemens syntax.
  • PLC counters — CTU, CTD, and CTUD counter instructions with runnable exercises.
  • Full scenario catalog — 170 source-catalogued practice records with tier badges and pattern tags.
  • Ladder logic vs structured text — when ladder patterns give way to structured text for complex control logic.

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

The core symbols are the normally open contact (--[ ]--, XIC in Allen-Bradley), the normally closed contact (--[/]--, XIO), and the output coil (--( )--, OTE). Latch and unlatch coils, one-shots, timer blocks, counter blocks and compare blocks build on those three.

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

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

Technical reference and worked-example guide

Ladder logic examples: field reference

Direct answer

The reader can explain each example as an input-state-output contract, identify its owned memory and test it at normal, boundary and fault conditions.

Written for pLC beginners and technicians studying start-stop, seal-in, interlock, timer, counter, sequence and alarm patterns before adapting them to a machine.

an automation engineer correlating ladder logic, scan timing, PLC I/O and a controlled test result at a debug bench while studying runnable ladder logic patterns with scan-by-scan acceptance tests
System map / 02

NODE 01observable

Definition

Process requirement, input states, output owner, memory, scan order, priority, timing, count, permissive, feedback, alarm, reset and restart policy.

NODE 02observable

Signal path

Operator or field condition through rung continuity and stored state to command, independent feedback, alarm and acceptance evidence.

NODE 03observable

Worked example

One start-stop, timer, counter and sequence example executed from a known initial state and explained scan by scan.

NODE 04observable

Limits

Simultaneous start and stop, held input, exact preset, repeated edge, feedback failure, reset, mode change, power return and stale state.

NODE 05observable

Common mistake

A requirement, contact-truth, state, scan-order, timing, count, output-owner, feedback or reset defect.

NODE 06observable

Verification

The selected pattern rewritten for the exact target and regression-tested against machine-specific requirements.

Answer surface / 07

What ladder logic examples should beginners learn first?

Learn input-to-output truth, stop-priority start-stop, seal-in state, interlocks, TON timing, CTU counting, step sequences, alarms and feedback mismatch in that order.

How do I test a ladder logic example?

Declare the initial state and expected outputs, then exercise normal operation, simultaneous inputs, exact time or count boundaries, reset, restart and at least one failed-feedback case.