Ladder Logic for Beginners: A Complete Step-by-Step Guide

Share:

PLC 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.

Zero Experience Needed All Basic Symbols Covered Real Rung Examples Timers and Counters

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.

What you will learn
- What ladder logic is and where it came from   
- 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.
Advertisement
Advertisement

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.

A simple way to think about it
Imagine an old-fashioned light switch circuit. You have a power source on the left, a switch in the middle, and a light bulb on the right. If the switch is closed (ON), power flows and the bulb lights up. Ladder logic works exactly the same way, except the switch is a sensor input and the bulb is a motor, valve or alarm output.

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.

Why ladder logic is still number one
  • 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:

PartWhat it isRepresents
Left railVertical line on the leftThe live power supply (positive side)
Right railVertical line on the rightThe neutral return (0V side)
RungEach horizontal row of logic between the railsOne complete control action. One rung = one logical statement
Basic ladder structure
|                                                              |
|     --[ ]--          --[ ]--               --( )--           |
|    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.

The most confusing thing for beginners
A Normally Closed (NC) contact does NOT mean the physical switch is normally closed. It means the contact instruction in the PLC passes power when the input bit is OFF (0). If a stop button is wired Normally Closed to the PLC, its PLC input bit will be 1 when not pressed. Using an NC contact instruction for a stop button means the rung passes power when the button is not pressed. This is correct and expected behaviour.
Advertisement
Advertisement

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.

AND logic: Motor runs only when Start AND Safety switch are both ON
|   --[ ]--        --[ ]--               --( )--    |
|   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.

OR logic: Alarm sounds when Sensor A OR Sensor B detects a fault
|   --[ ]--   +                       --( )--    |
|   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.

NOT logic: Fault light is ON only when Healthy signal is OFF
|   --[/]--                             --( )--    |
|   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 devicePLC input addressWired asPLC bit state when active
Start push buttonI0.0 (or X1)Normally Open1 (ON) when pressed
Stop push buttonI0.1 (or X2)Normally Closed0 (OFF) when pressed
Motor contactor outputQ0.0 (or Y1)Output coil1 (ON) to run motor

The ladder logic program

Motor start/stop with seal-in contact (self-latching)
|                                                          |
|   --[ ]--     --[/]--                    --( )--      |
|    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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
Why this is the most important circuit to learn
This same Start/Stop/Seal-in pattern appears in hundreds of variations in every industrial plant. Pump starts, conveyor starts, compressor starts, heater ON circuits. Once you understand this, you understand the core of 80% of ladder logic programs you will ever see.

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 typeWhat it doesCommon 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 timer: 5 second delay before cooling fan 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
Advertisement
Advertisement

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 typeWhat it doesCommon 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 counter: alarm after 100 product counts
|   --[ ]--                  --[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.

StepWhat happens
1. Input scanThe 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 executionThe 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 updateThe 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. HousekeepingThe 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.

Important: inputs are read ONCE per scan
The PLC takes a snapshot of all inputs at the beginning of each scan and uses those frozen values throughout program execution. If an input changes state halfway through a scan, the PLC will not see that change until the next scan. For very fast signals (shorter than the scan time), the PLC can miss them entirely. Use high-speed interrupt inputs for signals faster than the scan time.

Ladder Logic Symbols Reference Table

SymbolNameIEC NameWhat it doesWhen used
--[ ]--Normally Open contactXIC / Examine OnPasses power when input bit = 1 (ON)Start buttons, proximity sensors, any active-high input
--[/]--Normally Closed contactXIO / Examine OffPasses power when input bit = 0 (OFF)Stop buttons, safety switches, any active-low input
--( )--Output CoilOTE / Output EnergiseTurns output ON when rung is true. Turns OFF when rung is false.Motors, valves, lamps, any standard output
--(S)--Set (Latch) CoilOTL / SetTurns output ON and keeps it ON until a Reset instruction turns it OFFAlarms, motor run commands that must stay latched
--(R)--Reset (Unlatch) CoilOTU / ResetTurns OFF a latched outputAlways used with a Set coil to create latched outputs
--[P]--Positive TransitionOSR / P-contactPasses power for ONE scan only on rising edgeTriggering a single action from a push button
--[N]--Negative TransitionOSF / N-contactPasses power for ONE scan only on falling edgeDetecting when a signal turns OFF
[TON]On-Delay TimerTONOutput turns ON after input has been ON for the preset timeDelays, run-up times, sequence timers
[TOF]Off-Delay TimerTOFOutput stays ON for preset time after input turns OFFFan run-on, conveyor coast-to-stop delays
[CTU]Count Up CounterCTUIncrements count on each rising edge of inputProduct 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

Trusted external resources to continue learning ladder logic
Advertisement
Advertisement

Frequently Asked Questions: Ladder Logic for Beginners

What is ladder logic used for?
Ladder logic is used to program PLCs that control industrial machines and processes. It is used for starting and stopping motors, controlling conveyors, operating valves, managing timers and counters, and running safety interlocks in factories, plants and buildings.
Is ladder logic hard to learn?
Ladder logic is one of the easiest programming languages to learn. If you can read a simple electrical wiring diagram, you can understand ladder logic within a few hours. The basic symbols are few and the logic is visual and intuitive.
What is a rung in ladder logic?
A rung is one horizontal row of logic between the left and right power rails in a ladder diagram. Each rung represents one complete logical statement: a set of input conditions on the left that control one or more outputs on the right.
What is the difference between NO and NC contacts in ladder logic?
A Normally Open (NO) contact passes power when the associated input bit is ON (1). A Normally Closed (NC) contact passes power when the input bit is OFF (0). NC contact instruction blocks power when the input turns ON.
Can I practice ladder logic without a real PLC?
Yes. Free simulators like PLC Fiddle, Codesys (free version) and manufacturer software like Siemens TIA Portal Trial or Rockwell Studio 5000 Logix Designer let you write and simulate ladder logic on your computer without any hardware.
What is a seal-in contact in ladder logic?
A seal-in contact is a NO contact of the output coil placed in parallel with the start input. Once the output turns ON, the seal-in contact also turns ON, keeping power flowing even after the start input is released. This is how latching is achieved in ladder logic.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *