Ladder Logic
Ladder Logic is a graphical programming language for PLCs, originally developed as a digital successor to classic relay logic. The language uses a visual representation resembling electrical circuit diagrams and is used worldwide in Industrial Automation, machine building, SCADA systems and Process Automation.
In industrial environments, Ladder Logic is used for:
- Machine control
- Safety logic
- Interlocks
- Start/stop functions
- Motor control
- Process sequences
- Alarm functionality
Despite the rise of more modern languages such as Structured Text, Ladder Logic remains one of the most widely used programming languages in OT thanks to its high readability for electrical and maintenance teams.
⚙️ What is Ladder Logic
Ladder Logic is part of the IEC 61131-3 standard for PLC programming.
The language simulates traditional relay control using:
- Contacts
- Coils
- Timers
- Counters
- Comparators
- Function blocks
The logic is shown as horizontal “rungs” between two vertical rails.
Example structure:
|----[ ]----[ ]----( )----|
Where:
| Symbol | Function |
|---|---|
[ ] |
Normally Open contact |
[/] |
Normally Closed contact |
( ) |
Coil/output |
TON |
Timer On Delay |
CTU |
Counter Up |
🧱 Basic principles of Ladder Logic
Ladder Logic works by logical current flow from left to right.
A rung is evaluated as:
TRUE → output activeFALSE → output inactive
PLCs scan the program cyclically.
Typical PLC cycle:
Read inputs ↓Execute logic ↓Write outputs ↓Next scan
This cyclical operation is essential for deterministic control in OT environments.
🔌 Contacts and coils
Normally Open contact
A Normally Open (NO) contact is active when the linked variable is TRUE.
Example:
|----[ Start ]--------( Motor )----|
If Start = TRUE, then Motor is activated.
Normally Closed contact
A Normally Closed (NC) contact works inversely.
|----[/ Stop ]--------( Motor )----|
When Stop = FALSE, the logic remains active.
Output coils
Coils control:
- Relays
- Motor starters
- Lamps
- Valves
- Internal PLC bits
⏱️ Timers in Ladder Logic
Timers are essential in industrial control.
Commonly used timers:
| Timer | Function |
|---|---|
| TON | Timer On Delay |
| TOF | Timer Off Delay |
| TP | Pulse timer |
Example TON:
|----[ Sensor ]----[TON T1 5s]----|
When the sensor becomes active, the timer waits 5 seconds before activating the output.
Applications:
- Delays
- Start-up sequences
- Alarm filtering
- Motor delays
🔢 Counters
Counters count events within processes.
Examples:
| Counter | Function |
|---|---|
| CTU | Counter Up |
| CTD | Counter Down |
Use:
- Product counts
- Batch sizes
- Cycle counts
- Maintenance cycles
🏭 Ladder Logic in industrial automation
Ladder Logic is used in virtually all industrial sectors.
Production environments
Applications:
- Conveyor control
- Packaging machines
- Robot interlocks
- Motor control
Process industry
Used for:
- Pump control
- Valve actuation
- Alarm management
- Batch sequences
Building automation
In Building Automation for:
- HVAC
- Lighting
- Access control
- Energy management
🔄 Scan cycle and deterministic behaviour
PLCs execute Ladder Logic in fixed scan cycles.
Important parameters:
| Parameter | Typical value |
|---|---|
| Scan time | 1-50 ms |
| Input update | Cyclical |
| Output update | Cyclical |
| Jitter | Low |
Deterministic execution is essential in:
- Motion control
- Safety logic
- Real-time process control
Excessive scan times can lead to:
- Slow response
- Missed events
- Unstable processes
⚡ Retentive memory
Many PLCs support retentive variables.
These retain their value after:
- Power loss
- PLC restart
- Warm reboot
Important for:
- Batch numbers
- Counter values
- Process status
🧠 Interlocks and permissives
Ladder Logic is widely used for interlocks.
An interlock prevents dangerous situations.
Example:
Start motor only if:- Safety door closed- No alarm active- Emergency stop reset
Interlocks are used in:
🛡️ Ladder Logic and functional safety
For safety-critical applications, dedicated safety PLCs exist.
In Safety PLC systems, additional requirements apply:
- Segregated memory
- Diagnostics
- Redundancy
- Safe compiler
- Certification
Important standards:
| Standard | Application |
|---|---|
| IEC 61508 | Functional safety |
| IEC 61511 | Process safety |
| ISO 13849 | Machine safety |
| IEC 62061 | Safety control |
Safety Ladder Logic is often used for:
- Emergency stop circuits
- Light curtains
- Safety doors
- Safe motion control
🔄 Ladder Logic versus Structured Text
| Property | Ladder Logic | Structured Text |
|---|---|---|
| Electrical readability | High | Lower |
| Complex algorithms | Limited | Strong |
| Mathematical functions | Difficult | Good |
| Debugging | Visually strong | Less visual |
| Maintenance | Simple | More complex |
| Sequential logic | Good | Good |
Many modern PLC projects combine several languages.
🔌 Integration with SCADA and HMI
Ladder Logic often sends variables to:
Examples:
| Variable | Use |
|---|---|
| Motor status | HMI |
| Alarm bit | SCADA |
| Production counter | Historian |
| Process value | Trending |
Communication uses protocols such as:
🧪 Diagnostics and troubleshooting
A benefit of Ladder Logic is visual debugging.
Maintenance technicians can see in real time:
- Active contacts
- Energised coils
- Timer status
- Counter values
Common problems:
| Problem | Cause |
|---|---|
| Race conditions | Poor logic structure |
| Long scan times | Overload |
| Forgotten reset | Programming error |
| Oscillating outputs | Unstable inputs |
| Interlock problems | Wrong permissives |
⚠️ Common design errors
Excessive use of internal bits
Too many intermediate variables make logic hard to maintain.
Poor rung structure
Complex parallel networks reduce readability.
No modular design
Large monolithic PLC programs are hard to scale.
Best practices:
- Use function blocks
- Clear tag names
- Standardised templates
- Modular architecture
🔐 Cybersecurity risks
PLC programs are an important OT security target.
Attacks can:
- Manipulate outputs
- Disable safety
- Change process values
- Disrupt production
Known risks:
- Unauthorised changes
- Malware on engineering workstations
- Manipulation of PLC code
- Insider threats
Known examples such as Stuxnet specifically abused PLC logic.
🧱 Security measures
Important measures:
| Measure | Purpose |
|---|---|
| Network Segmentation | Isolation |
| Application Whitelisting | Approved software only |
| MFA | Access control |
| Version Control | Change management |
| Logging | Auditing |
| Patch Management | Vulnerability reduction |
| Backup | Recovery |
PLC programs often fall under formal Change Management.
🌐 Ladder Logic in Industry 4.0
Despite modern developments, Ladder Logic remains relevant.
New trends:
- Integration with Industrial AI
- Virtual PLCs
- Edge PLC runtime
- Cloud integration
- Digital twins
Modern PLC platforms combine:
- Classic Ladder Logic
- OPC UA
- REST APIs
- Edge analytics
📈 Benefits of Ladder Logic
Key benefits:
- High readability
- Widely supported
- Strong for discrete logic
- Easy troubleshooting
- Familiar to maintenance teams
- Deterministic behaviour
⚡ Limitations
Key limitations:
- Less suited to complex algorithms
- Difficult to scale in very large systems
- Limited abstraction
- Awkward for object-oriented design
- Less efficient for data processing
Complex systems are therefore often combined with:
- Structured Text
- Function Block Diagram
- SFC
