Ladder Logic Fundamentals for PLC Programming
Ladder logic has been the standard programming language for industrial control since PLCs replaced relay panels in the 1970s. It looks like a relay schematic, and that is exactly the point. Fifty years later it is still the dominant language on the factory floor, and the basics are part of the job for anyone whose work touches industrial equipment.
What Is Ladder Logic?
Ladder logic is a graphical PLC programming language that represents control logic as horizontal rungs between two vertical power rails, with input contacts on the left and output coils on the right. It is designed to look like a relay schematic so technicians who understand relay wiring can read and write PLC programs without learning text-based code. It is defined in the IEC 61131-3 standard.
How Do You Read a Ladder Diagram?
A ladder diagram has two vertical rails and a series of horizontal rungs. Power flows from the left rail to the right when the contacts on a rung are closed in the right combination, and the output device on the right end (usually a coil) energizes when power makes it across. The PLC scans top to bottom, rung by rung, then starts over, with a typical scan time of a few milliseconds. The program is always running, always checking inputs, and always updating outputs.
Contacts and Coils
The two basic instructions are contacts (which represent input conditions) and coils (which represent outputs).
Normally Open Contact
A normally open contact passes power when the bit it references is true, and opens when the bit is false. The symbol is two vertical lines with a gap between them. In a rung that says “when the start button is pressed, run the motor,” the start button is a normally open contact.
Normally Closed Contact
A normally closed contact is the opposite. It passes power when the referenced bit is false, and it opens when the bit is true. The symbol is two vertical lines with a diagonal slash through them.
Stop buttons are almost always programmed as normally closed contacts. As long as the stop button is not pressed, the contact passes power and the motor can run. Pressing the stop button breaks the contact and stops the motor. This is a safety convention. If the wire to a normally closed stop button breaks, the motor stops, which is the behavior you want. A broken wire to a normally open stop button would leave the motor running with no way to stop it.
Output Coil
An output coil energizes when power makes it across the rung. The symbol is a circle or oval at the right end of the rung. A coil represents either a physical output, like a contactor coil or solenoid, or an internal bit that other rungs reference.
What Is a Seal-In Rung in Ladder Logic?
Almost every motor control program contains a variation of the same rung. It is called a seal-in rung, or holding rung, and it solves the basic problem of how to keep a motor running after a momentary start signal. A normally open contact for the start button sits in series with a normally closed contact for the stop button, driving an output coil. In parallel with the start contact is a normally open contact that references the coil itself.
+–| START |–+–| /STOP |–( MOTOR )
| |
+–| MOTOR |—+
Pressing start energizes the coil, which closes the parallel contact and seals the rung in. Releasing start no longer matters, because the parallel contact keeps power flowing. Pressing stop opens the rung and the motor drops out. This is the same logic a relay-based motor starter has used for almost a hundred years, and it is the spine of most ladder programs.
Common Instructions Beyond Contacts and Coils
Specific instruction names vary by platform. Allen-Bradley, Siemens, Modicon, and Omron each have their own dialect, but the underlying behavior is the same. A TON in Studio 5000 does the same thing as an SE timer in TIA Portal.
| Instruction | What it does | Common use |
| TON (on-delay timer) | Counts up after the input turns on; done bit fires at the preset time | Dwell times, delays, sequencing |
| Up counter (CTU) | Increments on each input pulse; done bit fires at the preset count | Production counts, batch tracking |
| Compare (GRT, LES, EQU) | Tests one value against another | Analog thresholds, alarms |
| Math (ADD, SUB, MUL, DIV) | Performs arithmetic on register values | Scaling 4-20 mA, unit conversions |
| MOV (move) | Copies a value from one register to another | Setpoints, staging data for an HMI |
Timers
The most common is the on-delay timer (TON). When the input turns on, the timer counts up. When it reaches the preset, the done bit turns on and other rungs can use that bit to trigger downstream events. Timers handle delays, dwell times, and any logic that needs to wait.
Counters
An up counter increments each time its input turns on, and its done bit fires at the preset count. Counters track production counts, batch quantities, and cycle counts, and they have to be reset before they can count again.
Compare Instructions
Compare instructions check whether one value is greater than, less than, or equal to another. They are how the program handles analog inputs and process variables. A rung that says “when tank level is greater than 80 percent, turn on the high level alarm” uses a greater-than compare.
Math Instructions
Math instructions perform addition, subtraction, multiplication, and division. They are used for scaling analog values, calculating setpoints, and unit conversions. A flow meter that puts out a 4 to 20 milliamp signal needs a math instruction to convert that signal into gallons per minute.
Move Instructions
Move instructions copy a value from one register to another, for transferring data between parts of the program, setting initial values, or staging data before sending it to a display.
Latching and Unlatching
Most output coils only stay on while the rung is true. A latch instruction turns a bit on and leaves it on even after the triggering rung goes false, and the bit stays on until an unlatch on a different rung turns it off. Latches are useful for fault conditions that need operator acknowledgment, like a high-temperature fault that has to stay flagged until a technician clears it.
Subroutines and Program Structure
A real machine program is usually broken into multiple routines. There is typically a main routine that calls subroutines for each major piece of equipment, with the subroutines containing the detailed logic for starting, stopping, and monitoring it. This also makes common logic reusable. A subroutine that handles a single conveyor can be called many times with different inputs and outputs. Whatever the structure, comment every rung and use descriptive tag names like ConveyorOneRunning rather than B3:0/4. If you are running multiple PLCs across a site, this is also where remote monitoring of PLC control systems becomes valuable.
Online Editing and the Risks of It
Most modern PLCs allow online editing, meaning changes can be made while the program is running. A change downloaded to a running machine can produce unexpected behavior the moment it goes in, especially if it interacts with logic that is currently active. Race conditions are common when a rung references a bit that was renamed mid-edit. Real-time PLC performance monitoring helps catch these side effects before they cascade. When online editing is necessary, move slowly, change one thing at a time, and watch the machine.
Closing Thoughts
Ladder logic basic instructions can be picked up in an afternoon, but the patterns that produce maintainable programs come from doing the work and seeing what fails. If you are looking at a PLC program for the first time, start with the inputs. Find the start buttons, the stop buttons, and the safety interlocks, then trace the rungs to the output coils that drive the equipment.
If you have a PLC project that needs a fresh program, a working one modified, or a machine that won’t behave, our engineers do this work every day. Send us the details and we’ll tell you what it takes.

Svend Svendsen is the principal owner and a certified electrical engineer at Automation Electric & Controls Inc. Svend has decades of panel building experience specializing in custom industrial control systems, motor control panels, operator consoles, automated control systems, and custom control trailers. Automation Electric and Controls Inc. is a licensed ETL 508A panel building shop.
