Table of Contents
TogglePLC Programming · Ladder Logic · Beginner Guide
Ladder Logic for Beginners: A Complete Step-by-Step Guide
Learn what ladder logic is, how it works, all the basic symbols with examples, real-world rung diagrams and how to write your first PLC program from scratch.
If you are new to PLC programming, ladder logic is the best place to start. It is the most widely used programming language in industrial automation, used in over 80% of PLCs worldwide. The reason it became so popular is simple: it looks like a drawing, not a code. Anyone who can read an electrical wiring diagram can learn to read ladder logic in a single day.
Ladder logic was designed by engineers who wanted technicians and electricians to be able to program a PLC without learning a computer language. So instead of writing text commands, you draw contacts and coils on a screen that look almost identical to the relay control circuits people were already familiar with.
This guide explains what ladder logic is, how it works, what every symbol means, and how to write basic programs step by step. By the end, you will be able to read any simple PLC ladder program and write your own logic for motors, valves, timers and counters. If you are not sure what a PLC is yet, start with our article on what is a PLC and how it works.
- The structure of a ladder diagram (rails and rungs)
- All basic symbols: NO contact, NC contact, output coil, set, reset
- AND, OR and NOT logic in ladder
- Timers and counters explained simply
- The motor start/stop circuit explained step by step
- Common mistakes beginners make and how to avoid them.
What Is Ladder Logic?
Ladder logic is a graphical programming language used to write programs for Programmable Logic Controllers (PLCs). Instead of writing lines of text code, you create a diagram made up of contacts (inputs) and coils (outputs) connected between two vertical lines called rails.
The diagram looks like a ladder lying on its side, which is exactly where the name comes from. The two vertical rails represent the power supply lines, and each horizontal row of logic between them is called a rung.
Where did ladder logic come from?
Ladder logic was invented in the late 1960s when engineers at Modicon built the first PLC to replace panel after panel of physical relays used in automotive factories. The goal was to create a programming language that maintenance electricians could already understand without any retraining. So they designed the new language to look exactly like the relay wiring diagrams technicians were already reading every day.
Today, ladder logic is defined by the international standard IEC 61131-3, which means it works consistently across all PLC brands including Siemens, Allen-Bradley, Mitsubishi, Omron and Schneider Electric.
- Visual and intuitive. You can trace the logic with your eyes like a circuit diagram
- Familiar to anyone with electrical wiring knowledge
- Supported by every major PLC brand worldwide
- Easy to troubleshoot online. You can watch contacts turn green in real time on screen
- Standardised under IEC 61131-3
Structure of a Ladder Logic Diagram
Before learning the symbols, understand the physical structure of every ladder diagram. It has three parts:
| Part | What it is | Represents |
|---|---|---|
| Left rail | Vertical line on the left | The live power supply (positive side) |
| Right rail | Vertical line on the right | The neutral return (0V side) |
| Rung | Each horizontal row of logic between the rails | One complete control action. One rung = one logical statement |
| | | --[ ]-- --[ ]-- --( )-- | | Input 1 Input 2 Output 1 | | (Start Button) (Safety OK) (Motor ON) | | | | --[/]-- --( )-- | | Input 3 Output 2 | | (Stop Button NC) (Alarm ON) | | |
Power is imagined to flow from the left rail to the right rail through each rung. If all the input conditions on a rung are satisfied, power flows through to the output on the right. If any condition is not satisfied, power cannot flow and the output stays OFF.
The PLC executes each rung from top to bottom and left to right, one complete pass at a time. This is called the PLC scan cycle and it repeats continuously, typically every 1 to 50 milliseconds.
Ladder Logic Basic Symbols Explained
There are only a handful of basic symbols to learn. Once you know these, you can read and write most industrial ladder programs.
Normally Open (NO) Contact
--[ ]--Passes power when the input is ON (TRUE). This is the most common instruction. Used for push buttons, proximity sensors, limit switches that activate when pressed or detected.
Normally Closed (NC) Contact
--[/]--Passes power when the input is OFF (FALSE). Blocks power when the input is ON. Used for stop buttons and safety devices that should normally allow the circuit to run.
Output Coil (OTE)
--( )--The output instruction. When power flows through to the coil, the output turns ON. When power stops, the output turns OFF. It follows the rung logic exactly every scan.
Set Coil (OTL / SET)
--(S)--Latches the output ON when power flows. The output stays ON even after the input is removed. Must be reset using a Reset instruction to turn it OFF again.
Reset Coil (OTU / RST)
--(R)--Turns OFF a latched output that was set with the Set instruction. When power flows to the Reset coil, the corresponding output turns OFF and stays OFF.
Positive Edge Contact (OSR)
--[P]--Passes power for exactly ONE scan when the input changes from OFF to ON. Used when you need to detect the rising edge of a signal, not a continuous ON state.
AND, OR and NOT Logic in Ladder Logic
All logic in ladder diagrams comes down to three fundamental operations that you already know from everyday life.
AND Logic (Series contacts)
Place two contacts in series on the same rung. Both must be ON for the output to energise. This is exactly AND logic.
| --[ ]-- --[ ]-- --( )-- | | Start_Btn Safety_SW Motor_Run | Both must be ON for motor to run
OR Logic (Parallel contacts)
Place two contacts in parallel branches on the same rung. Either one being ON is enough for the output to energise. This is OR logic.
| --[ ]-- + --( )-- | | Sensor_A | Alarm | | | | | --[ ]-- + | | Sensor_B | Either sensor ON triggers the alarm
NOT Logic (NC contact)
A Normally Closed contact acts as a NOT. The output is ON only when the input is OFF. The NC contact inverts the signal.
| --[/]-- --( )-- | | Healthy Fault_Lamp | Lamp ON only when Healthy bit = 0 (OFF)
The Motor Start/Stop Circuit (The Most Important Ladder Example)
The motor start/stop circuit is the first program every PLC engineer learns. It is used in almost every industrial machine in the world. Understanding this one circuit teaches you about NO contacts, NC contacts, output coils and latching logic all at once.
What we want the circuit to do
- Press the Start button once: the motor starts and keeps running
- Press the Stop button: the motor stops
- The motor should NOT restart automatically when the Stop button is released
Wiring inputs to the PLC
| Field device | PLC input address | Wired as | PLC bit state when active |
|---|---|---|---|
| Start push button | I0.0 (or X1) | Normally Open | 1 (ON) when pressed |
| Stop push button | I0.1 (or X2) | Normally Closed | 0 (OFF) when pressed |
| Motor contactor output | Q0.0 (or Y1) | Output coil | 1 (ON) to run motor |
The ladder logic program
| | | --[ ]-- --[/]-- --( )-- | | I0.0 I0.1 Q0.0 | | Start_PB Stop_PB Motor_Run | | | | --[ ]-- | | Q0.0 | | Motor_Run | | (seal-in) | | |
The key to understanding this circuit is the seal-in contact (the second parallel NO contact of Q0.0). Here is what happens step by step:
- Start button pressed (I0.0 = 1) The top branch is complete: I0.0 is ON AND I0.1 NC is passing (Stop not pressed). Power flows to Q0.0. Motor_Run output turns ON. Motor starts.
- Start button released (I0.0 back to 0) The top contact opens. But now Q0.0 is ON, so the seal-in contact (Q0.0 on the parallel branch) is also ON. Power still flows through the bottom branch. Motor keeps running.
- Stop button pressed (I0.1 NC contact opens) The NC contact of the Stop button opens. No path from left rail to Q0.0 coil. Power cannot flow. Q0.0 turns OFF. Motor stops.
- Stop button released NC contact closes again. But now Q0.0 is OFF so its seal-in contact is also OFF. No power flow. Motor stays stopped until Start is pressed again.
Timers in Ladder Logic
Timers are one of the most commonly used ladder instructions after basic contacts and coils. They let you create time delays in your program. There are three types.
| Timer type | What it does | Common use |
|---|---|---|
| TON (On-Delay Timer) | Output turns ON after the input has been ON for the set time. Output turns OFF immediately when input goes OFF. | Motor run-up delay before next machine starts. Pump delay after valve opens. |
| TOF (Off-Delay Timer) | Output turns ON immediately when input goes ON. Output stays ON for the set time after input goes OFF. | Fan run-on after motor stops to cool the motor. Conveyor delay after machine is stopped. |
| RTO (Retentive On-Delay Timer) | Accumulates time across multiple input pulses. Does not reset when input goes OFF. Must be reset with a separate instruction. | Total running hours counter. Maintenance interval tracking. |
TON timer example: fan starts 5 seconds after motor starts
| --[ ]-- --[TON]-- | | Q0.0 Timer_1 | | Motor_Run PT = 5s | Rung 1: Start timer when motor is running | | | --[ ]-- --( )-- | | Timer_1.DN Fan_Output | Rung 2: Fan ON when timer done bit is set
The timer instruction has three important bits to know:
- EN (Enable bit): ON when the timer input rung is true (timer is running)
- TT (Timer Timing bit): ON while the timer is counting but not yet complete
- DN (Done bit): ON when the accumulated time equals the preset time
Counters in Ladder Logic
Counters count the number of times an event happens. They are used everywhere in industry: counting bottles on a conveyor, counting machine cycles, tracking batch quantities.
| Counter type | What it does | Common use |
|---|---|---|
| CTU (Count Up) | Increments the count by 1 each time the input transitions from OFF to ON. Done bit sets when count reaches preset value. | Counting products on a conveyor. Counting machine cycles before maintenance. |
| CTD (Count Down) | Decrements the count by 1 each time the input transitions from OFF to ON. Done bit sets when count reaches zero. | Counting remaining items in a batch. Dispensing a set quantity of product. |
| RES (Reset) | Resets the counter accumulated value to zero. Must be on a separate rung from the counter instruction. | Reset after batch is complete. Reset at start of each shift. |
| --[ ]-- --[CTU]-- | | Product_Sensor Counter_1 | | PV = 100 | Rung 1: Count products as each passes sensor | | | --[ ]-- --( )-- | | Counter_1.DN Batch_Alarm | Rung 2: Alarm when 100 products counted | | | --[ ]-- --[RES]-- | | Reset_Button Counter_1 | Rung 3: Reset counter for next batch
How the PLC Executes Ladder Logic (The Scan Cycle)
Understanding how a PLC reads and executes your ladder program is essential for writing correct logic. The PLC does not run all rungs simultaneously. It follows a continuous repeating loop called the scan cycle.
| Step | What happens |
|---|---|
| 1. Input scan | The PLC reads the current state of all input devices (sensors, switches, buttons) and copies these values into an internal memory area called the Input Image Table. |
| 2. Program execution | The PLC executes every rung of your ladder program from top to bottom, left to right, using the values stored in the Input Image Table. Output results are stored in the Output Image Table but not yet sent to field devices. |
| 3. Output update | The PLC writes the values from the Output Image Table to all physical output terminals. Outputs are only updated once per scan, at this step. |
| 4. Housekeeping | The PLC performs background tasks including watchdog timer reset, communication updates and self-diagnostics. Then the cycle repeats immediately. |
The time to complete one full cycle is called the scan time, typically 1 to 50 milliseconds. Learn more about the PLC scan cycle explained step by step.
Ladder Logic Symbols Reference Table
| Symbol | Name | IEC Name | What it does | When used |
|---|---|---|---|---|
| --[ ]-- | Normally Open contact | XIC / Examine On | Passes power when input bit = 1 (ON) | Start buttons, proximity sensors, any active-high input |
| --[/]-- | Normally Closed contact | XIO / Examine Off | Passes power when input bit = 0 (OFF) | Stop buttons, safety switches, any active-low input |
| --( )-- | Output Coil | OTE / Output Energise | Turns output ON when rung is true. Turns OFF when rung is false. | Motors, valves, lamps, any standard output |
| --(S)-- | Set (Latch) Coil | OTL / Set | Turns output ON and keeps it ON until a Reset instruction turns it OFF | Alarms, motor run commands that must stay latched |
| --(R)-- | Reset (Unlatch) Coil | OTU / Reset | Turns OFF a latched output | Always used with a Set coil to create latched outputs |
| --[P]-- | Positive Transition | OSR / P-contact | Passes power for ONE scan only on rising edge | Triggering a single action from a push button |
| --[N]-- | Negative Transition | OSF / N-contact | Passes power for ONE scan only on falling edge | Detecting when a signal turns OFF |
| [TON] | On-Delay Timer | TON | Output turns ON after input has been ON for the preset time | Delays, run-up times, sequence timers |
| [TOF] | Off-Delay Timer | TOF | Output stays ON for preset time after input turns OFF | Fan run-on, conveyor coast-to-stop delays |
| [CTU] | Count Up Counter | CTU | Increments count on each rising edge of input | Product counting, cycle counting, batch control |
Common Ladder Logic Mistakes Beginners Make
- Forgetting the seal-in contact on a start/stop circuit. Without the seal-in contact on the output coil, the motor will only run while the Start button is held down and stop the moment you release it. Always add the seal-in parallel contact.
- Confusing NO and NC contacts. Remember: NC contact in PLC ladder passes power when the input bit is 0 (the device is not activated). A Stop button wired NC to the PLC will have bit = 1 when not pressed, so use an NC contact instruction so it passes power normally and breaks when pressed.
- Using the same output coil address on two rungs. In most PLC brands, if the same output address (e.g. Q0.0) appears as an output coil on two different rungs, only the last rung evaluated (the lowest rung) will control the output. The first rung's result gets overwritten. Use Set/Reset pairs instead when you need multiple conditions controlling one output.
- Ignoring the scan cycle for fast signals. If a signal pulse is shorter than the PLC scan time, the PLC will miss it completely. Use high-speed interrupt inputs or edge detection contacts (OSR/P) for fast signals.
- Not adding comments to rungs. Always add a rung comment explaining what each rung does. Future engineers (and your future self) will be unable to understand the logic without comments after six months.
- Putting outputs on the left side of the rung. Outputs (coils) must always be on the rightmost position of the rung. Contacts (inputs) are always placed between the left rail and the output. Reversing this will cause a program error.
Further Reading and External Resources
- PLC Academy: Ladder Logic Tutorial. One of the most recommended free beginner resources with interactive examples.
- PLCopen: IEC 61131-3 Standard. The international standard that governs ladder logic and all PLC programming languages.
- RealPars: Ladder Logic Videos. Free video lessons explaining each ladder logic instruction with real PLC demonstrations.
- Automation.com: Ladder Logic Basics. Industry article covering ladder logic fundamentals and common industrial applications.
Frequently Asked Questions: Ladder Logic for Beginners
- What Is a PLC? Working Principle and Applications
- How PLC Scan Cycle Works: Step-by-Step Guide
- 9 PLC Data Types Explained: BOOL, INT, REAL and More
- PLC Block Diagram: Parts and Architecture Explained
- Types of Allen-Bradley PLCs: MicroLogix, CompactLogix and ControlLogix
- Communication Protocols in PLC: Types Explained
- Signals in Instrumentation: AI, AO, DI, DO Explained
- 8 Free PLC, SCADA and HMI Training Courses
What we learn today?
- Ladder logic is a graphical programming language for PLCs that looks like an electrical circuit diagram. It is the most widely used PLC language in the world.
- Every ladder diagram has two vertical rails (power lines) and horizontal rungs (one rung = one logical statement).
- The three core symbols are: NO contact (passes power when ON), NC contact (passes power when OFF), and Output Coil (turns ON when rung is true).
- Series contacts create AND logic. Parallel contacts create OR logic. NC contacts create NOT logic.
- The motor start/stop circuit with seal-in contact is the most fundamental program. Learn it completely before moving to any other logic.
- Timers (TON, TOF, RTO) and Counters (CTU, CTD) are the next most important instructions after basic contacts and coils.
- The PLC executes ladder logic in a repeating scan cycle: read inputs, execute program top to bottom, update outputs, repeat.
- Always add rung comments to your programs. Use free simulators to practise before working on a real PLC.
