Introduction to PLC Programming: Understanding Ladder Logic from Scratch
Programmable Logic Controllers (PLCs) are the backbone of industrial automation. They control everything from conveyor belts in automotive plants to packaging machinery in food processing facilities, water treatment systems, and HVAC control. If you are entering industrial automation, electrical engineering, or process control, PLC programming — specifically Ladder Logic — is a non-negotiable skill.
This guide introduces PLC Ladder Logic from the ground up, covering the fundamental concepts, common instructions, and practical programming examples that appear in real industrial applications.
What is a PLC?
A PLC (Programmable Logic Controller) is a rugged industrial computer designed to control physical processes reliably in harsh environments. Unlike a general-purpose computer, a PLC:
- Runs a cyclic scan: it reads all inputs, executes the program, updates all outputs, then repeats — typically 1-100 times per second
- Is designed for extreme temperature, vibration, electrical noise, and humidity
- Has deterministic response times — critical for safety and precision control
- Uses digital and analogue I/O to interface with real-world sensors and actuators
Major PLC manufacturers include Siemens (S7 series), Allen-Bradley (CompactLogix, MicroLogix), Mitsubishi (MELSEC), Omron, and Schneider Electric (Modicon). Indian industry primarily uses Siemens S7-1200, Allen-Bradley MicroLogix, and Delta PLCs.
What is Ladder Logic?
Ladder Logic (also called Ladder Diagram, LD) is the most widely used PLC programming language. It was developed to resemble traditional relay control panel drawings, making it intuitive for electricians and control engineers familiar with relay logic.
A Ladder Logic program consists of:
- Rungs: Horizontal rows of logic, like rungs on a ladder
- Left and right rails: Power rails — conceptually, current flows from left to right when logic conditions are met
- Contacts: Represent input conditions (normally open or normally closed)
- Coils: Represent output actions
Basic Ladder Logic Instructions
Normally Open (NO) Contact
Symbol: —[ ]—
Passes power (logic = TRUE) when the associated bit is ON (1). Like a switch that is open when not pressed and closes when pressed.
Normally Closed (NC) Contact
Symbol: —[/]—
Passes power when the associated bit is OFF (0). Opposite of NO contact — it is TRUE when the input is inactive.
Output Coil
Symbol: —( )—
Sets the associated bit to 1 when power reaches it (logic conditions to its left are all TRUE). Resets to 0 when conditions are FALSE.
Set Coil (Latch)
Symbol: —(S)—
Sets the bit to 1 when conditions are TRUE. Does NOT reset when conditions become FALSE — it stays ON until explicitly reset.
Reset Coil (Unlatch)
Symbol: —(R)—
Resets the bit to 0 when conditions are TRUE.
Your First Ladder Logic Program: Motor Start/Stop
The motor start/stop circuit is the “Hello World” of PLC programming. It demonstrates latching (memory) and normally closed stop buttons.
Physical Connections:
- I0.0 — START pushbutton (normally open, momentary)
- I0.1 — STOP pushbutton (normally closed, momentary)
- I0.2 — Motor overload contact (normally closed)
- Q0.0 — Motor contactor coil
Rung 1: Motor Start/Stop with Seal-In
|--[ START ]--+--[ MOTOR_ON ]-+--[/STOP]--[/OVERLOAD]--( MOTOR_ON )--|
| +---------------+ |
Explain:
- START (I0.0): Momentary normally open pushbutton
- MOTOR_ON (Q0.0): Parallel branch creates the "seal-in" (latch)
- STOP (I0.1): Normally closed — must be INVERTED (NC contact)
- OVERLOAD (I0.2): Normally closed protective device
How this works:
- Press START: I0.0 = 1, power flows through the rung, Q0.0 (MOTOR_ON) goes to 1
- Release START: Q0.0’s parallel branch (seal-in) keeps power flowing — motor stays ON
- Press STOP: I0.1 opens (NC contact), breaks power flow, Q0.0 = 0, motor stops
- Overload trips: I0.2 opens, breaks circuit, motor stops regardless of START
Timer Instructions
Timers are among the most-used PLC instructions. Three types are standard across most PLC platforms:
TON — Timer On Delay
Output turns ON after input has been ON for a specified time period. Used for delayed starts, conveyor sequencing, safety delays.
TOF — Timer Off Delay
Output turns OFF after input has been OFF for a specified time period. Used for motor run-down delays, ventilation hold-on timers.
TP — Timer Pulse
Output turns ON for a fixed duration when input goes ON, regardless of input state changes. Used for fixed-duration signals.
Example: Conveyor Start Delay with TON
Rung 1:
|--[ START ]--------( TON T1, 5s )--| // Start 5-second timer when START pressed
Rung 2:
|--[ T1.DN ]---------( CONVEYOR )--| // Conveyor starts when timer done (T1.DN = timer done bit)
Rung 3:
|--[/STOP ]-------(R CONVEYOR )--| // STOP button resets conveyor output
Counter Instructions
CTU — Count Up Counter
Increments accumulator value on each rising edge of count input. Commonly used for counting parts, cycles, or operations.
CTD — Count Down Counter
Decrements accumulator from a preset value.
Example: Bottle Count Rejection System
Rung 1:
|--[ BOTTLE_SENSOR ]--( CTU C1, 100 )--| // Count 100 bottles
Rung 2:
|--[ C1.DN ]--( REJECT_CONVEYOR )--| // Activate rejection after 100 counted
Rung 3:
|--[ C1.DN ]--( RES C1 )--| // Reset counter after triggering
Comparison and Math Instructions
PLCs support full arithmetic and comparison operations for analogue process control:
- EQU (Equal): TRUE when two values are equal
- NEQ (Not Equal): TRUE when values differ
- GRT (Greater Than): TRUE when value A > value B
- LES (Less Than): TRUE when value A < value B
- ADD, SUB, MUL, DIV: Arithmetic on integer or floating point values
Example: Temperature High Alarm
Rung 1:
|--[ GRT TEMP_AI, 75 ]--( HIGH_TEMP_ALARM )--|
// TEMP_AI = analogue input value (0-100°C scaled)
// If temperature > 75°C, trigger alarm output
Free PLC Simulation Software
Practice Ladder Logic without physical hardware:
- CODESYS (free version): Supports all 5 IEC 61131-3 languages including Ladder Logic. Runs software PLC on your PC. Industry-standard tool.
- OpenPLC Runtime: Open-source PLC runtime that runs on Raspberry Pi, Linux PC, or Arduino. Full Ladder Logic support.
- TIA Portal (Siemens, trial/student version): Professional Siemens S7 programming environment with simulation mode. Free for students through Siemens’ education program.
- AutomationDirect DoMore Designer (free): Free professional PLC IDE with built-in simulator.
IEC 61131-3 Programming Languages
Modern PLCs support five programming languages standardised in IEC 61131-3:
| Language | Type | Best For |
|---|---|---|
| Ladder Diagram (LD) | Graphical | Discrete logic, relay replacement |
| Function Block Diagram (FBD) | Graphical | Process control, analogue signals |
| Structured Text (ST) | Text | Complex algorithms, math |
| Sequential Function Chart (SFC) | Graphical | Sequential processes, batch control |
| Instruction List (IL) | Text | Legacy, assembly-like (deprecated) |
Frequently Asked Questions
Do I need physical PLC hardware to learn?
No. CODESYS running on your PC, or OpenPLC on a Raspberry Pi, gives you full PLC programming practice without expensive hardware. Physical PLCs start from ₹15,000-30,000 for entry-level units — use simulation first, then invest in hardware when you have specific project requirements.
Is Ladder Logic being replaced by Structured Text?
Ladder Logic remains dominant in discrete manufacturing and legacy industries in India. Structured Text is growing in process control and newer installations. A competent automation engineer should be comfortable with both. Learn Ladder Logic first (more immediately employable in Indian industry), then add Structured Text.
What certification should I get for PLC programming?
Siemens TIA Portal certification and Allen-Bradley (Rockwell) certifications are the most recognised in Indian industry. NSDC-affiliated automation training centres offer practical certifications. The best credential remains a project portfolio demonstrating real working automation programs.
How is PLC programming different from Arduino programming?
Arduino uses sequential C++ code; execution speed is the programmer’s concern. PLCs use cyclic scan with deterministic timing — the scan cycle guarantees all inputs are read before any output is updated. PLCs also have built-in fault handling, redundancy options, and industrial safety certifications that Arduino lacks.
Conclusion
Ladder Logic is not difficult to learn — it is visual, logical, and closely related to relay control circuits that electrical engineers already understand. Start with the motor start/stop circuit, add timers and counters, then explore analogue I/O and communication. Use free simulation software to practice daily. Within 3-6 months of consistent practice, you will be productive with real PLC systems. The demand for competent PLC programmers in India’s growing manufacturing sector makes this one of the highest-value automation skills you can acquire.
Add comment