Home Wiki Automation & Control Ladder Logic: The Foundation of PLC Programming
Automation & Control

Ladder Logic: The Foundation of PLC Programming

Contacts: Normally Open and Normally Closed

Ladder Logic is the oldest and most widely used PLC programming language. It uses graphical symbols that resemble electrical relay schematics, making it intuitive for electricians and maintenance technicians.

The two fundamental elements in Ladder Logic are contacts:

Normally Open (NO) contact --| |--: This contact is open (FALSE) by default and closes (TRUE) when its associated input or variable is energized. Think of it as a pushbutton that must be pressed to complete the circuit.

Normally Closed (NC) contact --|/|--: This contact is closed (TRUE) by default and opens (FALSE) when its associated input is energized. Think of it as an emergency stop button that breaks the circuit when pressed.

A rung of ladder logic reads from left to right, like a sentence. Contacts placed in series create an AND condition: all must be TRUE for current to flow. Contacts placed in parallel branches create an OR condition: any one being TRUE allows current to flow.

Series Example (AND Logic)

|--| I0.0 |----| I0.1 |-------------------( Q0.0 )|

Output Q0.0 is TRUE only when both I0.0 AND I0.1 are TRUE. In a factory context, this means the conveyor motor starts only when both the start button is pressed AND the safety guard is closed.

Parallel Example (OR Logic)

|--| I0.0 |--+---------------------------( Q0.0 )|
|             |                                    |
|--| I0.1 |--+                                    |

Output Q0.0 is TRUE when either I0.0 OR I0.1 is TRUE. This could represent two start buttons at different locations on a machine.

Coils: Driving Outputs

A coil is the output element of a ladder rung. When the logic conditions on the left evaluate to TRUE, the coil is energized.

Common coil types:

  • Standard coil ( ): output follows the logic state, ON when conditions are TRUE, OFF when FALSE
  • Set coil (S): once energized, the output latches ON and stays ON even if the input conditions go FALSE
  • Reset coil (R): turns OFF a previously set output
|--| I0.0 |------------------------------------(S Q0.0 )|
|--| I0.1 |------------------------------------(R Q0.0 )|

When I0.0 goes TRUE momentarily, Q0.0 is set ON and stays ON. Only when I0.1 goes TRUE does Q0.0 reset to OFF. This is the basis of memory in PLC programs.

The TON Timer in Ladder

The TON (Timer On-Delay) is the most commonly used timer in industrial automation. It starts counting when its input goes TRUE and produces a TRUE output after the preset time elapses.

|--| I0.0 |--------[TON T1, PT:=T#5s]-------( Q0.0 )|

In this rung, when input I0.0 goes TRUE, timer T1 begins counting. After 5 seconds, T1 output goes TRUE and energizes Q0.0. If I0.0 goes FALSE before 5 seconds, the timer resets and Q0.0 remains OFF.

Industrial application: a conveyor must run for 10 seconds after the last product is detected before stopping, ensuring all products clear the belt. The TON timer provides this delayed shutdown.

Timer Parameters

  • IN: the enable input (starts timing when TRUE)
  • PT: preset time (the desired delay)
  • Q: timer output (TRUE when elapsed time reaches preset)
  • ET: elapsed time (current count value)

The CTU Counter in Ladder

The CTU (Count Up) counter increments its current value by one on each rising edge of its count input. When the current value reaches the preset value, the output goes TRUE.

|--| I0.0 |--------[CTU C1, PV:=10]----------( Q0.0 )|
|                                                      |
|--| I0.1 |--------[RESET C1]                         |

Each time I0.0 transitions from FALSE to TRUE, counter C1 increments by one. When C1 reaches 10, output Q0.0 goes TRUE. Input I0.1 resets the counter to zero.

Industrial application: counting boxes on a conveyor. After every 10 boxes, the PLC activates a diverter to push the group onto a pallet. The counter resets and the next group begins.

Counter Parameters

  • CU: count up input (increments on rising edge)
  • RESET: resets current value to zero
  • PV: preset value (target count)
  • Q: output (TRUE when current value >= preset)
  • CV: current value (running count)

The Self-Holding Circuit (Latch)

The self-holding circuit, also called a seal-in or latch circuit, is one of the most important patterns in industrial PLC programming. It allows a momentary pushbutton press to start a motor that continues running until a stop button is pressed.

|--| Start |--+------|/| Stop |-------------( Motor )|
|              |                                       |
|--| Motor |--+                                       |

How it works:

  1. Pressing the Start button (I0.0) energizes the Motor coil (Q0.0)
  2. The Motor contact (second rung) closes, creating a parallel path around the Start button
  3. Releasing the Start button does not matter because the Motor contact holds the circuit
  4. Pressing the Stop button (I0.1, normally closed) breaks the circuit and the Motor de-energizes
  5. The Motor contact opens, removing the seal-in path

This is the standard motor control pattern used in every factory. The normally closed Stop contact ensures that if the Stop button wire breaks, the motor will stop, providing a fail-safe design.

Practical Example: Motor Start-Stop with Pushbuttons

Let us design a complete motor control circuit for a conveyor belt in a packaging line with these requirements:

  • Start pushbutton on I0.0 (normally open)
  • Stop pushbutton on I0.1 (normally closed)
  • Emergency stop on I0.2 (normally closed)
  • Motor overload relay feedback on I0.3 (normally closed)
  • Motor contactor output on Q0.0
  • Running indicator lamp on Q0.1
|--| I0.0 |--+--|/| I0.1 |--|/| I0.2 |--|/| I0.3 |---( Q0.0 )|
|             |                                                  |
|--| Q0.0 |--+                                                  |
|--| Q0.0 |----------------------------------------------( Q0.1 )|

Rung 1 implements the self-holding motor control with three stop conditions: the stop button (I0.1), the emergency stop (I0.2), and the overload relay (I0.3). All three are wired as normally closed for fail-safe operation. If any wire breaks or any button is pressed, the motor stops.

Rung 2 drives the running indicator lamp whenever the motor contactor is energized.

This simple two-rung program controls a real industrial conveyor. Every element maps directly to a physical wire in the control panel, which is why electricians find ladder logic so accessible.

Summary

Ladder Logic uses contacts (NO and NC) and coils to represent relay-style logic in a graphical format. Series contacts create AND conditions, parallel contacts create OR conditions. Timers (TON) provide timed delays, and counters (CTU) track events. The self-holding circuit is the fundamental pattern for motor control, using a parallel contact to maintain the output after a momentary start command. These building blocks combine to create complete industrial control programs that are easy for maintenance personnel to read and troubleshoot.

ladder-logic contacts coils timer counter rung السلم المنطقي التلامسات الملفات المؤقت العدّاد الدرجة