Ladder Logic Programming for Beginners
When you open the PLC programming environment for the first time, The programming, ladder logic can make you confuse, because it using collection of lines and symbols. The important thing is to understand, how the PLC evaluates each rung from left to right, then the logic becomes easy and clear to understand.
What Is Ladder Logic?
Ladder logic is a graphical programming language used in programmable logic controllers (PLCs) to make the industrial process automation. It uses symbols that seems electrical relay diagrams, with two vertical rails representing power and horizontal rungs containing control logic. Ladder logic is very simple and easy, once you have pure understanding.
PLCs use ladder logic because it look like the relay logic that electricians and control engineers were already familiar with before programmable controllers existed. Each rung represents a control statement. The PLC evaluates each rung from left to right, checking input conditions and controlling outputs based on whether those conditions are TRUE or FALSE.
A typical rung has contacts on the left side that represent input conditions and a coil on the right side that represents an output or internal memory bit. If all the required conditions on the left are TRUE, the coil on the right becomes energized.

How a PLC Executes Ladder Logic
Understanding the PLC scan cycle matters because it explains why certain control behaviors happen.
The scan cycle works like this:
Read Inputs
The PLC reads all physical input states and stores them in memory.
Execute Program
The PLC read the ladder logic program and checks each programming rung, before moving to the next one rung, to execute the complete program.
Update Outputs
The PLC writes output states to physical output terminals.
Repeat
The cycle starts again, typically completing thousands of times per second.
This matters during troubleshooting. If an input changes state during program execution, the PLC does not see that change until the next scan. If a counter appears to count multiple times from a single event, scan cycle behavior is usually the reason.

Ladder Logic Contacts and Coils
Contacts and coils are the building blocks of ladder logic.
A contact examines a Boolean condition. It reads the state of an input, output, internal memory bit, timer status, or counter status. The contact allows logic to pass through if its condition is TRUE.
A coil writes to a Boolean condition. It sets an output, internal memory bit, or control instruction to TRUE or FALSE based on whether the logic leading to it is TRUE.
This distinction matters because contacts do not only represent physical inputs, and coils do not only represent physical outputs.
For example, a contact can examine the state of an output that was turned ON by another rung. A coil can write to an internal memory bit that has no physical output terminal but is used for control logic elsewhere in the program.
The flow works like this:
Field Device → PLC Input State → Ladder Contact → Logic Evaluation → Ladder Coil → PLC Output State → Physical Machine
Allen-Bradley PLC controllersNO vs NC Contacts
Normally open (NO) and normally closed (NC) contacts cause confusion when you working for the first time with PLCs.
A physical normally open pushbutton is open when not pressed. When you press it, the contacts close and current flows. A physical normally closed pushbutton is closed when not pressed. Pressing it opens the contacts and stops current flow.
In the PLC the ladder logic contact instruction looks at the state not the actual physical contact.
In Allen Bradley PLC ladder logic, the XIC (examine if closed) instruction is true, when the Boolean state is true. The XIO (examine if open) instruction is true, when the Boolean state is false. This is how it works with the XIC and XIO instructions, in Allen Bradley PLC ladder logic.
Here is where the confusion happens. If you have a physical normally open pushbutton wired to a PLC input, and you use an XIC instruction to examine that input, the instruction is TRUE only when the button is pressed. The PLC does not care whether the field device is physically NO or NC. It only cares about the Boolean states of the input.
If you wire the physical emergency stop button with normally close contact to PLC input, the input state will remain TRUE when the button is not pressed. If you using XIC instruction, the rung is TRUE during normal operation and FALSE when someone presses the emergency stop.
Knowing this difference helps prevent wiring and programming mistakes when programming and testing the PLC.
| Condition | Physical NO Button | PLC Input State | XIC Result | XIO Result |
| Button not pressed | Open | FALSE | FALSE | TRUE |
| Button pressed | Closed | TRUE | TRUE | FALSE |
| Condition | Physical NC Button | PLC Input State | XIC Result | XIO Result |
| Button not pressed | Closed | TRUE | TRUE | FALSE |
| Button pressed | Open | FALSE | FALSE | TRUE |

Series and Parallel Contacts
Series contacts create AND logic. Parallel contacts create OR logic.
When contacts are arranged in series, all contacts must be TRUE for the logic to pass through to the coil. This is Boolean AND.
In this rung, Output becomes TRUE only when both Input_1 AND Input_2 are TRUE.
When contacts are arranged in parallel, only one contact needs to be TRUE for the logic to pass through. This is Boolean OR.
In this rung, Output becomes TRUE when Input_1 OR Input_2 is TRUE.
You can combine series and parallel logic to create complex conditions.
This logic says Output is TRUE if (Input_1 AND Input_2) OR Input_3.
Ladder Logic Latching and Seal-In Circuits
A basic motor start/stop circuit is one of the first thing you may program in ladder logic to test that how ladder logic works,
If you use start pushbutton to turn on the motor, the motor turns off, when you release the button state. To keep the motor running, you need a seal-in circuit or contact to use to maintain the circuit energize, also called a latch contact.
Here is how it works. When you press START, the START contact becomes TRUE. If OVERLOAD is also TRUE (meaning no fault condition exists), MOTOR turns ON.
Once MOTOR is ON, the second branch with the MOTOR contact becomes TRUE. This seals in the circuit or the Latch circuit. Even when you release START, MOTOR stays ON because the MOTOR contact keeps the path TRUE.
To stop the motor, you press STOP. The STOP rung forces MOTOR to FALSE, breaking the seal-in branch in the first rung.
If OVERLOAD becomes FALSE (an overload relay trips), the MOTOR output turns off even if START is still held. You can also use the other way with NC contact after changing the field wiring from the field.
This control pattern appears almost every industrial PLC program. It handles motor control, pump control, valve sequencing, and conveyor systems.
Motor Full Load CurrentPLC Timers
Timers control time-based sequences in industrial systems. A common use is delaying a motor start, running a process for a specific duration, or creating a safety delay before allowing the next step in a sequence.
PLC timers have three main types.
TON (Timer On-Delay) starts timing when the enable input becomes TRUE. When the accumulated time reaches the preset value, the done bit becomes TRUE. If the enable input goes FALSE before the timer finishes, the accumulated value resets to zero.
TOF (Timer Off-Delay) starts timing when the enable input goes FALSE. The done bit is TRUE while the input is TRUE. When the input goes FALSE, the timer starts. After the preset time, the done bit goes FALSE.
RTO (Retentive Timer On-Delay) works like TON but retains the accumulated value even if the enable input goes FALSE. You must use a separate reset instruction to clear the accumulated value.
Here is how a TON timer works in a conveyor sequence.
When START is pressed, Conveyor_1 turns on. The second rung enables Timer_1. After the preset time (say 5 seconds), Timer_1.DN (done bit) becomes TRUE. The third rung then turns on Conveyor_2.
This creates a delayed start sequence, preventing both conveyors from starting at the same time and reducing electrical demand.
PLC Counters
Counters track the number of events, such as products passing a sensor, machine cycles, or material batches.
CTU (Count Up) increments the accumulated value each time the count input transitions from FALSE to TRUE. When the accumulated value reaches the preset, the done bit becomes TRUE.
CTD (Count Down) decrements the accumulated value each time the count input transitions from FALSE to TRUE.
A common problem with counters is repeated counting. If a sensor detects a product and the sensor signal stays TRUE for several PLC scans, the counter increments multiple times for a single product.
This happens because the PLC scan cycle executes thousands of times per second. If the output of sensor remains in TRUE state, even for 50 milliseconds, then the counter may count 10 or 20 times.
You can use one-shot or rising-edge instruction for this in ladder logic. It turn ON for only one PLC scan, when the input changes from FALSE to TRUE state, even if the input stays TRUE for several scans.
In Allen-Bradley, you use ONS (one-shot) instruction. In Siemens, you use a positive edge detection contact.
Now the counter increments only once per product, regardless of how long the sensor stays TRUE.
Practical Industrial Ladder Logic Example
A simplified coal crusher conveyor system demonstrates how these concepts work together.
The system has two conveyors. Conveyor_1 feeds coal into a crusher. Conveyor_2 removes crushed material. The control requirements are:
- Conveyor_2 must be running before Conveyor_1 can start (interlock).
- Conveyor_1 starts after a 3-second delay once the start button is pressed.
- If the crusher overload trips, both conveyors stop.
- A sensor counts batches of crushed material.
The first rung checks that START is pressed and Conveyor_2 is already running. This is an interlock that prevents Conveyor_1 from starting if the downstream conveyor is not ready.
The second rung enables a 3-second timer. Preset 3000 = 3 seconds
The third rung turns on Conveyor_1 only after the timer completes and no overload condition exists.
The fourth rung counts batches using a one-shot to prevent repeated counting.
The fifth rung keeps Conveyor_2 running as long as there is no overload.
If the crusher overload and cause to overload trips, NOT_Overload becomes FALSE, shutting down both conveyors.
Ladder Logic Troubleshooting
Troubleshooting ladder logic requires a methodical approach.
First check what output is not working. Then follow the ladder rung from left to right. Check each contact and see if it is TRUE or FALSE. When the PLC is online, the programming software shows the live status of the contacts and coils. This helps you find where the logic is stopping the output.
| Symptom | Possible Cause | What to Check |
| Output does not turn ON | One or more conditions are FALSE | Trace each contact from left to right |
| Motor turns OFF after START is released | Seal-in branch is missing or broken | Check the latch contact in parallel with START |
| Timer never completes | Enable input is dropping FALSE | Monitor the timer enable condition |
| Counter counts multiple times per event | No edge detection | Add a one-shot instruction |
| Output stays OFF | Interlock condition is FALSE | Trace permissive logic |
| Output changes unexpectedly | Another rung is controlling the same tag | Search the entire program for the output tag |
A useful troubleshooting method is forcing values. Most PLCs allow you to temporarily force an input or output to TRUE or FALSE for testing. Force an input TRUE and see if the output responds. If it does, the field wiring or sensor is the problem. If it does not, the logic is the problem.
Never leave force conditions active after troubleshooting. Forced values override real field conditions and can cause unsafe machine behavior.
Allen-Bradley and Siemens Ladder Logic
The basic usage of contacts, coils, timers, and counters is same in all PLCs. However, different PLC brands use different software and names for some of these instructions.
Allen-Bradley uses Rockwell Automation software like RSLogix or Studio 5000. Instructions include:
- XIC (Examine If Closed)
- XIO (Examine If Open)
- OTE (Output Energize)
- OTL (Output Latch)
- OTU (Output Unlatch)
- TON, TOF, RTO (Timers)
- CTU, CTD (Counters)
Siemens uses TIA Portal or Step 7. The ladder logic editor is called LAD. Instructions include:
- Normally Open Contact
- Normally Closed Contact
- Output Coil
- Set and Reset Coils
- TON, TOF, TONR (Timers)
- CTU, CTD (Counters)
The logic structure is the same. A series contact represents AND. A parallel contact represents OR. Timers count time. Counters count events. The differences are mostly in naming and how you enter the logic.
Common Ladder Logic Mistakes
Avoid these common errors when writing or troubleshooting ladder logic.
Confusing physical device state with PLC instruction type. A physical normally closed button does not automatically require an XIO instruction. Use the instruction that makes sense for the logic.
Assuming every contact is a physical input. Contacts can examine outputs, internal bits, timer bits, or counter bits.
Ignoring scan cycle effects. Counters and one-shots behave the way they do because of how the PLC scans the program.
Forgetting seal-in logic. If you want an output to stay on after a momentary input goes FALSE, you need a latch.
Not using one-shot logic with counters. Without edge detection, counters increment repeatedly while the input is TRUE.
Ignoring interlocks. Always check permissive conditions before starting equipment.
Not tracing every condition. When troubleshooting, check every contact in the rung. One FALSE condition stops the entire rung.
Creating complex rungs. Break complicated logic into smaller, easier-to-read rungs.
Not testing fault conditions. Test what happens when sensors fail, overloads trip, or emergency stops are pressed.
Ladder Logic Best Practices
Use clear tag names. Instead of “Output_1,” use “Conveyor_Motor” or “Crusher_Start.” This makes troubleshooting faster.
Keep rungs simple. If a rung has more than four or five contacts, consider breaking it into multiple rungs.
Add comments. Most PLC software lets you add rung comments. Describe what the rung does, especially for interlocks and permissives.
Use consistent naming. If you name one motor “Motor_1_Run,” name the next one “Motor_2_Run,” not “M2_Status.”
Separate fault logic from control logic where it makes sense. This makes it easier to trace fault conditions during troubleshooting.
Test normal operation and fault operation. Make sure the program works when everything is running correctly and when something goes wrong.
Document sequences. For complex control sequences, write a description of what should happen step by step. This helps during commissioning and future troubleshooting.
variable frequency drivecreate a project in RSLogix 5000 Modbus RTU vs Modbus TCP PLC cybersecurity and remote access AI integration in PLC systemsFAQ
What is ladder logic programming?
Ladder logic is the simple PLC programming language use to program the PLC using the ladder logic diagram that looks like a traditional electrical control circuit. It uses contacts to check conditions and coils to control outputs or internal bits.
What is a rung in ladder logic?
A rung is a single line of logic in a ladder program. The PLC evaluates each rung from left to right. If all the conditions on the left are TRUE, the output or coil on the right is energized.
What is the difference between NO and NC ladder logic?
In ladder logic, NO (Normally Open) and NC (Normally Closed) shows how the instruction execute the Boolean states. The NO instruction (XIC in Allen-Bradley) is TRUE; when the Boolean state is TRUE. and the NC instruction (XIO) is TRUE, when the Boolean state is FALSE.
What are XIC and XIO?
XIC (Examine If Closed) is an Allen-Bradley instruction that becomes TRUE when the examined Boolean state is TRUE. XIO (Examine If Open) becomes TRUE when the examined Boolean state is FALSE.
What is a ladder logic coil?
A coil is an instruction that writes to a Boolean state. It can control a physical output, set an internal memory bit, or trigger another instruction. The coil is energized when the logic leading to it is TRUE.
How does the PLC scan cycle affect ladder logic?
The PLC read inputs, executes the program, and updates the outputs, input changes during program execution are not consider until the next scan start, which affects counter behavior, one-shots and output response time.
How does a TON timer work?
A TON (Timer On-Delay) starts timing when its enable input becomes TRUE. When the accumulated time reaches the preset value, the done bit becomes TRUE to indicates timer completed. If the enable input goes FALSE before completion, the timer resets.
Why does a PLC counter count multiple times?
Counters increment each time the count input transitions from FALSE to TRUE. If the input stays TRUE for multiple PLC scans, the counter may increment repeatedly. Use a one-shot instruction to count only once per event.
What is a seal-in circuit?
A seal-in circuit uses a parallel contact to keep an output energized after a momentary input goes FALSE. It is used in motor start and stop circuits to keep the motor running, when the start button is released/Pressed, if using push button, until stop button pressed.
How do you troubleshoot ladder logic?
Its not easy until you are well experienced, But you can trace the logic and checking each contact to see the specific output if it is TRUE or FALSE. Use online monitoring to view live logic states. Check for missing seal-in branches, false interlocks, and incorrect contact types.
Ladder logic is one of the five programming languages defined in the international IEC 61131-3 standard, making it the most widely used method for programming PLCs in industrial automation.




