← SCADA Studio
Engineering·15 min read·April 20, 2026

⚙️ PLC Ladder Logic Programming: A Practical Guide for Beginners

Learn how to read and write PLC ladder logic programs — contacts, coils, timers, counters, and function blocks. Covers Allen-Bradley and Siemens syntax, structured text comparison, and a full worked example, plus a free interactive ladder logic simulator.

📖PLC Programming, Wiring, Process Control & Instrumentation — Illustrated Guide (Full Access)
View →

What Is Ladder Logic?

Ladder Diagram (LD) — commonly called ladder logic — is the most widely used PLC programming language. It was designed to resemble relay logic schematics, making it familiar to electricians transitioning to programmable controllers. A ladder logic program consists of rungs (like the rungs of a ladder) that are evaluated sequentially from top to bottom. Each rung contains contacts (inputs) on the left and coils (outputs) on the right, connected by power rails representing DC power.

Ladder logic is one of five IEC 61131-3 standard languages. The others are: Function Block Diagram (FBD), Sequential Function Chart (SFC), Structured Text (ST), and Instruction List (IL). Most PLCs support multiple languages, and complex programs often use several — a motor-sequencing rung might be written in ladder logic while a PID loop or a string-parsing routine for a barcode scanner is written in structured text within the same project.

Want to see it run before reading further? The PLC Ladder Logic Simulator lets you build and execute the exact rung types covered in this guide — start/stop seal-in circuits, safety interlocks, and on-delay timers — with a live rung visualization, free in your browser.

Contacts: Reading Inputs

A normally open (NO) contact is represented by two vertical lines (——| |——). It passes power (logic true) when the referenced bit is 1. This is the most common contact type, used to read push buttons, limit switches, proximity sensors, and internal logic bits.

A normally closed (NC) contact (——|/|——) passes power when the referenced bit is 0. Used to implement stop buttons, safety interlocks, and "not" logic. Important: a physical normally closed pushbutton connected to a PLC input will hold the bit at 1 when unpressed — use a NO instruction to read a NC physical switch.

Coils: Controlling Outputs

An output coil (——( )——) turns on a physical output (motor starter coil, solenoid valve, indicator light) or sets an internal bit when the rung evaluates as true. A set (latch) coil turns a bit on and holds it on even if the rung goes false. A reset (unlatch) coil turns the bit off. Set/reset pairs are used to implement push-on/push-off control or to capture momentary events. A rung should never drive the same output coil twice elsewhere in the program (a "duplicate coil" condition) — most programming software flags this as a warning, and on the rare PLC that allows it, only the last-scanned rung's value wins, which is a common source of "the logic looks right but the output won't turn on" bugs.

Timers

Timers are among the most-used PLC instructions. The three main types:

  • TON (Timer On Delay): Starts timing when the rung goes true. The output (.DN) bit turns on after the preset time. Used for starting delays, conveyor sequencing, and process timing.
  • TOF (Timer Off Delay): Starts timing when the rung goes false. The output stays on for the preset time after the rung drops out. Used for pump cool-down timers and conveyor runout.
  • RTO (Retentive Timer): Accumulates time across multiple rung-true intervals. Must be reset explicitly. Used for runtime hour meters.

Every timer instruction exposes three key members: .PRE (the preset time you configure), .ACC (the running accumulated time), and .DN (a bit that turns on once .ACC reaches .PRE). A rung can test .DN directly, or compare .ACC against a different value to build logic that changes behavior partway through a timed sequence — for example, sounding a warning horn at 80% of a delay before a conveyor actually starts.

Counters

CTU (Count Up): Increments the accumulated count each time the rung transitions from false to true. The .DN bit sets when accumulated value reaches the preset. Used for part counting, batch control, and production totals.

CTD (Count Down): Decrements from the preset value. Used for material allocation and inventory control.

Counters share the same .PRE/.ACC/.DN structure as timers, but only change on a false-to-true transition of the rung, not continuously — a counter rung that stays true does nothing further until it drops false and goes true again. This is the single most common counter mistake for beginners: wiring a counter directly to a proximity sensor that stays "on" while a part is under it counts once correctly, but a poorly-debounced or noisy sensor can register several false-to-true transitions on one part and over-count. A CTU is almost always paired with a reset rung (driving the counter's .RES instruction) once a batch total is reached or a shift changes, since an un-reset counter accumulates forever and eventually rolls over.

A Simple Motor Start/Stop Circuit

The classic ladder logic motor start/stop: Rung 1 — Start button NO contact (I:0/0) in parallel with Motor Run bit (B3:0/0), in series with Stop button NC contact (I:0/1), driving Motor Run coil (B3:0/0). Rung 2 — Motor Run bit (B3:0/0) driving Motor Output coil (O:0/0). The parallel Start/Run contact is the "seal-in" circuit — once started, releasing the start button keeps the motor running through the parallel path. Try this exact circuit yourself in the PLC Ladder Logic Simulator's start/stop seal-in scenario, then extend it with the safety-interlock and on-delay timer scenarios to see how those building blocks combine.

Allen-Bradley vs. Siemens: Same Logic, Different Syntax

The rung above uses classic Allen-Bradley SLC-500/PLC-5 addressing (I:0/0 for input, O:0/0 for output, B3:0/0 for a binary bit). Modern platforms address the same concepts differently, but the underlying ladder logic concepts — contacts, coils, seal-ins, timers, counters — are identical across every brand:

  • Allen-Bradley Studio 5000 / RSLogix 5000 (ControlLogix, CompactLogix): Uses tag-based addressing instead of raw memory addresses — a start button might be tagged Pump1_Start directly rather than I:0/0, with the underlying I/O module mapping handled separately. Timers are the TON/TOF/RTO instructions with .PRE/.ACC/.DN members exactly as described above.
  • Siemens TIA Portal / Step 7 (S7-1200/1500): Uses symbolic addressing tied to a physical address like %I0.0 (input byte 0, bit 0) or %Q0.0 (output). Timers are function blocks — TON, TOF, and TP (pulse timer) — instantiated with their own instance data block rather than a simple three-member structure, but they expose the same PT (preset time), ET (elapsed time), and Q (done) concepts.
  • Mitsubishi, Omron, and other IEC 61131-3-compliant platforms follow the same standard closely enough that a controls engineer fluent in one brand's ladder logic can read another's within minutes — the rung-and-rail visual language, and the contact/coil/timer/counter vocabulary, are effectively universal even though exact addressing syntax, instruction names, and configuration screens differ.

This is why ladder logic remains the default teaching language for industrial controls: the visual metaphor transfers directly from a physical relay panel to any PLC brand, and the underlying concepts transfer from any one PLC brand to any other.

Ladder Logic vs. Structured Text vs. Function Block Diagram

All three are IEC 61131-3 languages that can implement the exact same control logic — the choice is about which is clearest for a given task, not which is more "correct":

  • Ladder logic excels at discrete on/off control with clear physical analogs — start/stop circuits, interlocks, sequencing — because the rung visually mirrors the relay panel it's replacing. It becomes harder to read once logic involves heavy math, string handling, or complex branching.
  • Structured text (ST) looks like Pascal or BASIC (IF Pump1_Start AND NOT Pump1_Stop THEN Pump1_Run := TRUE; END_IF;) and is far better suited to math-heavy calculations, PID tuning logic, recipe/batch sequencing with many variables, and string parsing for barcode/RFID/protocol data — the kind of logic that becomes an unreadable sprawl of parallel branches in ladder form.
  • Function Block Diagram (FBD) represents logic as interconnected blocks (AND, OR, timers, PID blocks) wired together, and is common in process-control-heavy platforms and in Siemens environments for analog/PID-centric logic.

A real industrial project routinely mixes all three: ladder logic for the discrete start/stop and interlock logic an electrician needs to troubleshoot with a multimeter and the program side by side, structured text for a batching recipe or a communication-driver routine, and function blocks for a PID loop — see the PLC Scan Cycle concept explainer for how the PLC executes all of this within a single scan.

A Full Worked Example: Conveyor Start/Stop with Safety Interlock

Beyond the isolated motor circuit above, here is how the building blocks combine into one small but complete real-world rung set — the same conveyor scenario modeled in the ladder logic simulator's safety-interlock exercise:

  • Rung 1 (Safety OK): E-stop NC contact, in series with a guard-door NC contact, driving an internal "Safety_OK" bit. Both devices must be intact/closed for this bit to be true.
  • Rung 2 (Seal-in start): Start pushbutton NO contact, in parallel with Conveyor_Run bit, in series with Stop pushbutton NC contact AND Safety_OK bit, driving Conveyor_Run.
  • Rung 3 (Timed alarm horn): Conveyor_Run bit drives a TON timer with a 3-second preset; the timer's .DN bit drives the physical conveyor motor output, so the horn (wired directly to Conveyor_Run) sounds for 3 seconds before the belt actually moves.
  • Rung 4 (Jam counter): A photoelectric "part present" sensor pulse drives a CTU counter; once the count reaches a batch preset, the counter's .DN bit sets a "Batch Complete" bit and stops the conveyor, and a separate reset rung (tied to an operator acknowledge button) resets the counter for the next batch.

Notice that Rung 1's Safety_OK bit is referenced as a contact in Rung 2 rather than duplicating the E-stop and guard-door logic on every rung that needs it — this is standard practice: compute a safety condition once, then reference the resulting bit everywhere it's needed, so a single hardware change (adding a second guard door, for instance) only requires editing one rung.

Best Practices

Use descriptive tag names (not I:0/3 but PUMP_1_START). Comment every rung. Keep rungs simple — one action per rung. Use subroutines (JSR/RET) to organize large programs. Implement safety interlocks in hardware in addition to the PLC logic — never rely solely on ladder logic for life-safety functions. Force I/O only for troubleshooting, document every forced point, and remove all forces before returning a system to normal production. When a program grows past a handful of rungs, group related rungs under a comment header and split unrelated sequences (conveyor control, alarm handling, HMI data prep) into separate subroutines rather than one long unbroken rung list.

Once these building blocks make sense, the next skill is diagnosing a system that's already running — see the PLC Troubleshooting Guide for a structured diagnostic approach, and the How to Read a Control Schematic guide for the hardware-relay ladder diagrams this software logic is directly descended from. For a complete worked automation project from a plain-language requirement through I/O list, sequence of operations, ladder rungs, and commissioning, see the full PLC conveyor design project in the SCADA studio.

Topics covered

PLC ladder logicPLC programmingladder diagramIEC 61131PLC tutorialAllen BradleySiemens PLCRSLogixStudio 5000TIA Portalladder logic simulator
Share

🛠️ Related Tools

📚 Continue in the SCADA Studio

📝

SCADA/ICS System Architecture — Practice Exam 2

✨ Premium Content

Go beyond the free practice questions with a full-length paid exam bank.

🎓

Industrial Controls Project — Start to Finish (Full Access)

✨ Premium Content

A structured, paid professional training program for this discipline.

📖

PLC Programming, Wiring, Process Control & Instrumentation — Illustrated Guide (Full Access)

✨ Premium Content

A zoomable interactive reader — free preview, then unlock the full set.

🧮

PID Control Loop Simulator — Tune Kp, Ti & Td on a Live Process Trend

✨ Premium Content

A paid interactive calculator or 3D simulator for this discipline — part of the All-Access Pass.

⚙️

Also explore the Industrial & Systems Engineering Studio

A related engineering discipline with its own tools, calculators, and articles.

Related Articles

📬 Get new engineering guides in your inbox

New calculators, interactive readers, and reference guides — no spam, unsubscribe anytime.

Put this knowledge to work on your iPhone

Browse our full catalog of professional iOS apps — from electrical code tools to AI builders.

Browse All 95+ Apps