Ladder Logic Tutorial: PLC Programming Step by Step
Learn ladder logic step by step with a working motor-control example, scan-cycle explanation, test matrix, troubleshooting checks, and safety limits.
Ladder logic tutorial: the shortest useful answer
Ladder logic is a graphical PLC programming language built from contacts, coils, functions, and function blocks arranged in networks or “rungs.” Learn it by building one small circuit, predicting each scan, testing every input combination, and only then translating the platform-neutral logic into your PLC vendor's exact instructions.
What you will be able to build
| Stage | Practical outcome | Evidence that it works |
|---|---|---|
| Inputs and outputs | Map field signals to named Boolean tags | I/O list matches the electrical drawing |
| Contacts and coils | Write AND, OR, NOT, and seal-in logic | Truth table passes in simulation |
| Scan behavior | Predict what changes on the current and next scan | Online trace matches the prediction |
| Timers and counters | Add an on-delay and event count | Boundary tests pass before, at, and after each preset |
| Fault handling | Separate permissives, trips, reset, and indication | Every simulated fault reaches the intended state |
| Commissioning | Transfer tested logic to the chosen platform | Signed test sheet and rollback copy exist |
Review and version boundary (25 July 2026): this tutorial follows the current IEC 61131-3:2025 language model, which includes Ladder Diagram (LD). The examples are deliberately platform-neutral. Contact symbols, timer members, task scheduling, addressing, online edits, and instruction names vary by controller family and software release; verify them in the manual for the exact CPU, firmware, and engineering-tool version you will use.

Build your first complete rung: motor request with a seal-in
Use this as a learning exercise, not as a machine-safety circuit. The PLC output represents a run request to a correctly engineered motor-control system; it does not replace an emergency stop, guard circuit, overload protection, disconnect, or safety-rated control function.
1. Define the I/O contract
| Tag | Type | Meaning | Safe test value |
|---|---|---|---|
Start_PB |
BOOL input | Momentary start request | FALSE |
Stop_OK |
BOOL input | Stop circuit is healthy | FALSE |
Permissive_OK |
BOOL internal/input | Non-safety process permissives are satisfied | FALSE |
Motor_Run_Cmd |
BOOL output | Command to the motor-control layer | FALSE |
2. Express the requirement
The command may energize when Stop_OK and Permissive_OK are true and either the start button is pressed or the command is already latched:
Motor_Run_Cmd :=
Stop_OK
AND Permissive_OK
AND (Start_PB OR Motor_Run_Cmd);
In ladder form, put Stop_OK and Permissive_OK in series, then place Start_PB in parallel with a Motor_Run_Cmd sealing contact before the output coil. Use vendor-neutral tag names first; map physical addresses only after the behavior is reviewed.

3. Run the acceptance test
| Test | Start | Stop OK | Permissive | Previous run | Expected command |
|---|---|---|---|---|---|
| Safe startup | 0 | 0 | 0 | 0 | 0 |
| Blocked start | 1 | 1 | 0 | 0 | 0 |
| Start accepted | 1 | 1 | 1 | 0 | 1 |
| Seal-in holds | 0 | 1 | 1 | 1 | 1 |
| Stop opens | 0 | 0 | 1 | 1 | 0 |
| Permissive drops | 0 | 1 | 0 | 1 | 0 |
| Power-up check | 0 | 1 | 1 | 0 | 0 |
Record the actual result for every row. Also test a stuck input, communications loss if remote I/O is involved, task restart, and power restoration. A simulator can validate logical behavior; hardware commissioning must still verify wiring, polarity, output de-energization, device feedback, and the applicable safety design.
Prerequisites for Learning Ladder Logic
You do not need prior software-development experience, but you should understand Boolean logic, basic control wiring, and electrical safety before working with physical equipment. Begin in a simulator or isolated training panel, never on an operating production machine.
For software choices, use the free PLC programming software guide. For browser-based logic practice, PLC Simulation Software provides graded exercises without requiring a production controller. Ownership disclosure: PLC Programming operates PLC Simulation Software. It is a learning and prototyping tool, not a production PLC, vendor runtime, safety system, or substitute for hardware commissioning; review the versioned product facts before relying on a feature or access limit.
Ladder Logic Symbols Cheat Sheet
Essential Ladder Logic Symbols Reference
Download Our Free Ladder Logic Symbols Cheat Sheet - Complete Guide
| Symbol | Name | Function | When Active |
|---|---|---|---|
| --[/]-- | Normally Open Contact | Allows power flow when TRUE | Input is ON/TRUE |
| --[/]-- | Normally Closed Contact | Allows power flow when FALSE | Input is OFF/FALSE |
| --( )-- | Output Coil | Energized when power flows through rung | Power reaches coil |
| --( / )-- | Negated Output Coil | Opposite logic output | Power does NOT reach coil |
| --[TON]-- | Timer On-Delay | Delays turning output ON | After time delay expires |
| --[TOF]-- | Timer Off-Delay | Delays turning output OFF | After time delay expires |
| --[CTU]-- | Counter Up | Counts input pulses upward | Count reaches preset |
| --[CTD]-- | Counter Down | Counts input pulses downward | Count reaches zero |
| --[OSR]-- | One Shot Rising | Single pulse on rising edge | Input transitions OFF to ON |
| --[MOV]-- | Move | Transfers data between locations | When rung is TRUE |
Timer and Counter Status Bits:
- TT: Timer Timing Bit (ON while timer is running)
- DN: Done Bit (ON when timer/counter is complete)
- EN: Enable Bit (ON when instruction is active)
- CU: Count Up Enable
- CD: Count Down Enable
- OV: Overflow (counter exceeded maximum)
- UN: Underflow (counter went below zero)
Common Ladder Logic Programming Patterns
Start/Stop Circuit with Seal-In:
|--[Start]--[Stop]--+--[Motor_Run]--( Motor_Run )--|
I:1/0 I:1/1 | O:2/0 O:2/0
|
+--[Aux_Contact]--|
O:2/0
Timer Delay Circuit:
|--[Input]--[TON Timer_1]--|
I:1/0 Preset: 50 (5 seconds)
Timebase: 0.1 sec
|--[Timer_1.DN]--( Output )--|
O:2/0
Counter Circuit:
|--[Count_Input]--[CTU Counter_1]--|
I:1/0 Preset: 10
|--[Counter_1.DN]--( Batch_Complete )--|
O:2/0
How ladder logic maps to a PLC scan
The visual “power flow” is a programming model, not physical current. A typical cyclic task samples or reads inputs, evaluates logic in a defined order, and updates outputs. The exact I/O update model, task priorities, immediate-I/O behavior, and execution order are vendor and configuration dependent, so use the controller documentation when scan timing affects the result.

Chapter 1: Ladder Logic Fundamentals for Beginners
Understanding the Ladder Logic Concept
Ladder Logic derives its name from its resemblance to electrical ladder diagrams used for relay-based control systems. The "rails" on either side represent power supply connections, while "rungs" between the rails contain the control logic using contacts, coils, and other elements.
Power Flow Principles Power flows from the left rail through various contact elements to energize output coils on the right side of each rung. This left-to-right power flow concept is fundamental to understanding how Ladder Logic programs execute and how different elements interact.
Basic Programming Elements
- Normally Open (NO) Contacts: Allow power flow when the associated input is TRUE
- Normally Closed (NC) Contacts: Allow power flow when the associated input is FALSE
- Output Coils: Energize when power flows through the rung to control physical outputs
- Internal Memory Bits: Provide temporary storage and program control functions
Program Execution Model PLCs execute Ladder Logic programs in a continuous scan cycle: read all inputs, execute program logic from top to bottom, update all outputs, then repeat. Understanding this scan cycle is crucial for effective programming and troubleshooting.
Chapter 2: Basic Contact and Coil Programming

Creating Your First Program
Start with a simple program that uses a normally open contact to control an output coil. This basic circuit demonstrates fundamental power flow concepts and provides the foundation for all Ladder Logic programming.
|--[/]--( )--|
I:1/0 O:2/0
This rung shows an input (I:1/0) controlling an output (O:2/0). When the input is energized, power flows through the contact to energize the output coil.
Adding Multiple Conditions
Combine multiple contacts to create logical AND and OR operations:
Series Contacts (AND Logic):
|--[/]--[/]--( )--|
I:1/0 I:1/1 O:2/0
Parallel Contacts (OR Logic):
|--[/]----------( )--|
| I:1/0 O:2/0
|--[/]----------|
I:1/1
Implementing Start/Stop Control
The start/stop circuit with seal-in logic represents one of the most important Ladder Logic concepts:
|--[/]--[/]--+--[/]--( )--|
I:1/0 I:1/1 | O:2/0 O:2/0
|
+--[/]--|
O:2/0
This circuit shows a start button (I:1/0), stop button (I:1/1), and auxiliary contact (O:2/0) providing seal-in logic to maintain the output after the start button is released.

Chapter 3: Timers and Counters
Timer On-Delay (TON) Instructions
Timers provide time delays essential for sequential operations and process control:
|--[/]--[TON]--|
I:1/0 Timer: T4:0
Preset: 100
Time Base: 1.0 sec
|--[/]--( )--|
T4:0/DN O:2/0
This shows a 10-second delay timer that energizes output O:2/0 when the timer completes.
Counter Up (CTU) Instructions
Counters track events and quantities in automated systems:
|--[/]--[CTU]--|
I:1/0 Counter: C5:0
Preset: 50
|--[/]--( )--|
C5:0/DN O:2/0
This counter energizes the output after counting 50 input transitions.
Combining Timers and Counters
Real applications often combine timers and counters for complex operations like timed production runs or batch counting with time limits.
Chapter 4: Mathematical and Comparison Operations
Basic Arithmetic Operations
Modern PLCs support mathematical operations for process control and data manipulation:
|--[/]--[ADD]--|
I:1/0 Source A: N7:0
Source B: N7:1
Dest: N7:2
Comparison Instructions
Comparison operations enable decision-making based on numerical relationships:
|--[GRT]--( )--|
Source A: N7:0
Source B: N7:1 O:2/0
This Greater Than (GRT) instruction energizes the output when N7:0 is greater than N7:1.
Data Movement Operations
Move (MOV) instructions transfer data between memory locations:
|--[/]--[MOV]--|
I:1/0 Source: N7:0
Dest: N7:5
Chapter 5: Advanced Programming Techniques
Subroutine Programming
Organize complex programs using subroutines that can be called from multiple locations:
|--[/]--[JSR]--|
I:1/0 Subroutine File: 3
Input Parameter: N7:0
Interrupt Programming
Handle high-priority events using interrupt routines that execute immediately when triggered:
|--[/]--[INT]--|
I:1/0 Interrupt: I:0
State Machine Programming
Implement sequential operations using state machine approaches that provide clear program organization and flow control.

Error Handling
Implement systematic error detection and recovery procedures that ensure safe system operation under all conditions.
Chapter 6: Troubleshooting and Best Practices
Online Monitoring Techniques
Use programming software online monitoring capabilities to observe program execution in real-time, identifying which logic paths are active and which conditions are preventing desired operation.
Systematic Troubleshooting Approach
- Understand the intended operation and identify symptoms
- Use online monitoring to observe actual program behavior
- Check input conditions and verify field device operation
- Trace power flow through program logic systematically
- Verify output operation and field device response
Programming Best Practices
- Use consistent naming conventions for addresses and descriptions
- Document program purpose and complex logic sequences thoroughly
- Organize programs into functional sections for clarity
- Test programs systematically before and after modifications
- Maintain backup copies and version control for all programs
Common Programming Mistakes
- Incorrect use of normally open vs. normally closed contacts
- Missing seal-in logic in latching circuits
- Timer and counter preset values in wrong units
- Mathematical operation overflow conditions
- Inadequate error handling for fault conditions
Practical Exercise: Complete Motor Control System
Build a comprehensive motor control system that incorporates multiple Ladder Logic concepts:
Requirements:
- Start/stop pushbutton control with indicator lights
- Automatic timer-based operation mode
- Production counter with preset limits
- Alarm indication for fault conditions
- Manual reset capability after alarms
Implementation Steps:
- Design the control logic using fundamental Ladder Logic concepts
- Implement start/stop control with proper seal-in logic
- Add timer functions for automatic operation sequences
- Integrate counter functions for production tracking
- Include alarm detection and indication logic
- Test the complete system operation thoroughly
Practice Exercises for Beginners
Exercise 1: Simple Start/Stop Control
Objective: Create a basic motor control circuit with start/stop buttons
Requirements:
- Start button (normally open) - I:1/0
- Stop button (normally closed) - I:1/1
- Motor output - O:2/0
- Auxiliary contact for seal-in logic
Step-by-Step Solution:
- Create new rung in your PLC programming software
- Add normally open contact for Start button (I:1/0)
- Add normally closed contact for Stop button (I:1/1) in series
- Add parallel branch with motor auxiliary contact (O:2/0)
- Add output coil for motor (O:2/0)
- Test program in simulation mode
Expected Behavior:
- Pressing Start energizes motor
- Motor stays on after releasing Start (seal-in)
- Pressing Stop turns off motor
- Motor stays off until Start is pressed again
Exercise 2: Traffic Light Control System
Objective: Program a simple 3-light traffic signal sequence
Requirements:
- Red light - O:2/0 (30 seconds)
- Yellow light - O:2/1 (5 seconds)
- Green light - O:2/2 (25 seconds)
- System start input - I:1/0
- Total cycle time: 60 seconds
Programming Steps:
- Create timer for Red light (30 seconds)
- Create timer for Yellow light (5 seconds)
- Create timer for Green light (25 seconds)
- Use timer done bits to sequence between states
- Add logic to reset and repeat cycle
Exercise 3: Production Counter with Alarm
Objective: Count parts and activate alarm at preset quantity
Requirements:
- Part sensor input - I:1/0
- Reset button - I:1/1
- Production counter - preset to 50 parts
- Batch complete light - O:2/0
- Counter display value
Advanced Features:
- Add shift counter for daily totals
- Include reject counter for quality tracking
- Add timer for cycle time monitoring
Exercise 4: Tank Level Control System
Objective: Control pump based on tank level sensors
Requirements:
- Low level sensor - I:1/0 (start pump)
- High level sensor - I:1/1 (stop pump)
- Pump output - O:2/0
- Pump status light - O:2/1
- Safety override - I:1/2
Safety Requirements:
- Pump cannot run without safety override
- Add pump runtime timer for maintenance tracking
- Include alarm for pump failure conditions
Common Beginner Mistakes and How to Avoid Them
Mistake 1: Incorrect Contact Types
Problem: Using normally open contact when normally closed is needed (or vice versa)
Example of Wrong Logic:
|--[Emergency_Stop]--( Motor )--| // WRONG!
I:1/0 (NO) O:2/0
Correct Logic:
|--[/Emergency_Stop/]--( Motor )--| // CORRECT!
I:1/0 (NC) O:2/0
How to Avoid: Always consider the physical state of inputs and desired logic behavior.
Mistake 2: Missing Seal-In Logic
Problem: Output turns off when momentary start button is released
Wrong Approach:
|--[Start]--( Motor )--| // Motor turns off when Start released
I:1/0 O:2/0
Correct Approach:
|--[Start]--[Stop]--+--[Motor]--( Motor )--|
I:1/0 I:1/1 | O:2/0 O:2/0
|
+--[Aux]-----|
O:2/0
Mistake 3: Timer Unit Confusion
Problem: Setting timer preset in wrong time units
Common Error: Setting timer to 50 thinking it's 50 seconds when timebase is 0.1 seconds (actually 5 seconds)
Solution: Always verify timebase settings:
- Timebase 1.0 sec: Preset 50 = 50 seconds
- Timebase 0.1 sec: Preset 50 = 5 seconds
- Timebase 0.01 sec: Preset 50 = 0.5 seconds
Mistake 4: Scan Time Dependencies
Problem: Assuming ladder logic executes like electrical circuits
Issue: PLC scans program top to bottom, left to right in cycles
Best Practices:
- Don't rely on instruction execution order within single scan
- Use appropriate timers for time-dependent operations
- Understand that all inputs are read at scan start, outputs updated at scan end
Mistake 5: Inadequate Documentation
Problem: No comments or descriptions for addresses and logic
Poor Practice:
|--[I:1/0]--[I:1/1]--( O:2/0 )--|
Good Practice:
|--[Start_Button]--[Stop_Button]--( Motor_Contactor )--|
I:1/0 I:1/1 O:2/0
"Start Pump" "Emergency "Main Motor
Stop" Contactor"
Advanced Practice Projects
Project 1: Automated Packaging Line
Description: Complete packaging system with conveyor control, counting, and quality checking
Components:
- Product feed conveyor
- Inspection station with reject logic
- Counting and batching system
- Box filling and sealing sequence
- Fault detection and recovery
Project 2: Multi-Tank Batch Process
Description: Chemical mixing process with recipe control and safety systems
Features:
- Multiple ingredient tanks with level control
- Mixing sequence with temperature and time control
- Recipe selection and parameter storage
- Simulated permissives and fault responses; safety functions remain outside this training project
- Batch tracking and reporting
Project 3: Parking Garage Control System
Description: Automated parking facility with entry/exit control
Requirements:
- Vehicle detection sensors
- Gate control logic
- Occupancy counting and full parking indication
- Payment system integration
- Security and access control features
Troubleshooting Your First Ladder Logic Programs
Systematic Troubleshooting Approach
Step 1: Verify Physical Connections
- Check all input device wiring
- Verify output device connections
- Test input signals with multimeter
- Confirm PLC power supply voltage
Step 2: Use Online Monitoring
- Connect programming software to PLC
- Monitor input status in real-time
- Observe power flow through program rungs
- Check timer and counter accumulated values
Step 3: Test Individual Components
- Force inputs ON/OFF to test program logic
- Manually energize outputs to verify field devices
- Check timer and counter operation separately
- Verify mathematical operations and data movement
Step 4: Analyze Program Flow
- Trace power flow from inputs to outputs
- Identify which conditions prevent desired operation
- Check for conflicting logic or parallel branches
- Verify proper use of normally open/closed contacts
Common Troubleshooting Tools
Programming Software Features:
- Online monitoring with real-time values
- Force inputs and outputs for testing
- Trending and data logging capabilities
- Cross-reference for finding tag usage
Hardware Tools:
- Digital multimeter for voltage/current measurement
- Test lights for quick output verification
- Signal generators for input simulation
- Oscilloscope for timing analysis
Building Your Ladder Logic Programming Career
Entry-Level Positions
- Maintenance technician
- Controls technician
- Junior automation engineer
- PLC programmer
Advanced Career Paths
- Senior automation engineer
- Control-systems lead
- Automation consultant
- Automation project manager
Titles, licensing rules, and compensation vary materially by country, industry, travel requirements, and responsibility. Use the PLC programmer salary guide for sourced market context rather than treating a tutorial as salary evidence.
Skills Development Roadmap
Phase 1: Foundation (0-6 months)
- Master basic ladder logic programming
- Learn one major PLC platform (Allen Bradley or Siemens)
- Complete simple automation projects
- Understand electrical control principles
Phase 2: Intermediate (6-18 months)
- Learn HMI development and SCADA systems
- Study industrial communication protocols
- Gain experience with motion control systems
- Complete complex multi-system projects
Phase 3: Advanced (18+ months)
- Specialize in specific industries (automotive, process, etc.)
- Learn advanced programming languages (Structured Text, Function Blocks)
- Develop safety system programming expertise
- Build project management and leadership skills
Training and credentials
Choose training only after checking the current provider catalogue. Vendor course names and credential availability change. Prioritize a course that requires you to build, test, document, and troubleshoot a complete program on the platform you use. ISA's Certified Control Systems Technician (CCST) is one industry credential to evaluate; vendor training should be verified directly with the vendor or an authorized training partner.
Conclusion: Your Ladder Logic Mastery Journey
Mastering ladder logic programming provides the foundation for successful careers in industrial automation while opening doors to advanced programming techniques and specialized applications. The concepts and techniques covered in this comprehensive tutorial represent the core knowledge needed for professional PLC programming in any industry or application.
This tutorial has equipped you with essential skills including:
- Fundamental Concepts: Power flow, contacts, coils, and program execution
- Essential Instructions: Timers, counters, mathematical operations, and data handling
- Programming Patterns: Start/stop circuits, sequential operations, permissives, and fault responses
- Troubleshooting Skills: Systematic problem-solving and debugging techniques
- Professional Practices: Documentation, testing, and career development guidance
Your Next Steps:
- Practice Regularly: Work through all exercises and build additional projects
- Choose Specialization: Select PLC platform and industry focus based on career goals
- Gain Hands-On Experience: Volunteer for automation projects or seek apprenticeships
- Continue Learning: Pursue formal training, certifications, and advanced topics
- Network Professionally: Join automation organizations and connect with industry experts
Remember that ladder logic programming mastery comes through consistent practice, hands-on experience, and exposure to real-world applications and challenges. Start with simple programs and gradually work up to more complex applications as your skills and confidence develop. The ladder logic examples library on PLC Simulation Software has annotated worked examples for every rung pattern covered in this tutorial — open them in your browser and tweak the logic to see exactly what breaks.
The automation industry offers excellent opportunities for those who invest in developing their ladder logic programming skills and staying current with evolving technologies. Focus on building both technical programming competence and understanding of industrial processes, safety requirements, and business needs that drive automation decisions.
Your journey in ladder logic programming has strong foundations from this tutorial, but continued practice and real-world application will develop the expertise needed for professional success in industrial automation. Keep learning, practicing, and building the skills that will serve you throughout your automation career.
Official sources and review limits
- IEC 61131-3:2025 — Programmable controllers, programming languages
- PLCopen logic resources and IEC 61131-3 training material
- PLCopen downloads, including Ladder Diagram introductions
Sources and linked platform information were reviewed on 25 July 2026. This tutorial explains portable concepts; it does not certify a program, machine, person, or controller. Use the exact vendor instruction reference, electrical drawings, risk assessment, and site commissioning procedure for a real installation.
Master Advanced PLC Programming Techniques
Ready to advance beyond basic ladder logic and master professional PLC programming methods? Download our comprehensive "Advanced PLC Programming Techniques Guide" and accelerate your automation career.
What you'll learn:
- Advanced programming techniques used in commercial projects
- Professional debugging and troubleshooting methods
- System integration and communication strategies
- Safety system programming and validation
- Career development paths for automation professionals
Get the Complete PLC Programming Guide →
Related Learning Resources:
- Free PLC Programming Software Downloads - Practice with professional tools
- Siemens vs Allen Bradley PLC Comparison - Choose your platform specialization
- HMI Programming Tutorial Complete Guide - Learn human machine interface development


