Ladder logic for beginners: program a PLC with no hardware
Published on Nov 5, 2026
Ladder logic (ladder diagram) is the most widely used graphical language for programming PLCs: the program looks like an electrical control schematic, with contacts on the left, a coil on the right, and power “flowing” from left to right. You can learn it without buying a PLC, vendor software or a license: the 4DVolt electrical workbench has a virtual PLC with a Ladder editor and live simulation, wired to pushbuttons, contactors and a motor.
What a PLC is and why Ladder
A PLC (programmable logic controller) is a small industrial computer that reads inputs (pushbuttons, sensors, switches), runs a program and drives outputs (contactors, indicator lamps, valves). Ladder, defined in the IEC 61131-3 standard, was designed so that electricians could program it with the same logic as relay panels: if you can read a control circuit, you can read Ladder.
One note: the workbench PLC follows IEC 61131-3 in a generic way. The symbols and logic apply to any brand, but addresses, advanced instructions and each manufacturer’s software differ.
How to read a Ladder program
The program is a stack of rungs between two vertical rails: the left one is power, the right one is the return. Each rung is read from left to right. If there is a path of “closed” contacts all the way to the coil, the coil turns on.
- Inputs have addresses
I1,I2… and come from the PLC input terminals. - Outputs are
Q1,Q2… and drive the output relays. - Memory bits (
M1…) are internal flags with no physical terminal, used to store a state. - Timers (
T1…) and counters (C1…) complete the set.
Contacts and coils
| Symbol | Name | Conducts when |
|---|---|---|
-| |- | NO contact (normally open) | The address is on (1) |
-|/|- | NC contact (normally closed) | The address is off (0) |
-|P|- | Rising edge | Only at the instant the address goes from 0 to 1 |
-|N|- | Falling edge | Only at the instant it goes from 1 to 0 |
-( )- | Coil | Turns the address on while the rung conducts |
-(/)- | Negated coil | Turns the address on while the rung does not conduct |
-(S)- / -(R)- | Set and reset | S latches on; R switches off |
Something that trips up people coming from electrical work: a Ladder contact is a question about the state of an address, not a physical part. An NC contact of I2 conducts when input I2 is off. That is why wiring an emergency stop (NC in real life) needs care: the program logic depends on how the button is wired to the terminal.
First program: switching a load
The simplest rung has one contact and one coil: an NO I1 in series with coil Q1. Press the pushbutton wired to I1 and output Q1 turns on; release it and it turns off. It works like a doorbell button, but it does not “remember” anything yet.
Seal-in logic: a program that holds itself on
In motor control the operator presses “start”, lets go, and the motor keeps running until someone presses “stop”. This is done with a seal-in (latching) contact: an NO contact of the output itself, in parallel with the start button.
I1(NO) is the start button.- In parallel,
Q1(NO): the output’s own contact. - In series with both,
I2(NC) is the stop button. - At the end of the rung, coil
Q1.
Press I1 and Q1 turns on. With Q1 on, the parallel contact conducts by itself and the rung stays energized after you release I1. Pressing I2 opens the path, the coil drops, the seal-in contact opens and everything returns to rest. It is the same seal-in as a contactor control circuit, just done in software.
Interlocking: two outputs that must never be on together
In motor reversing, the “forward” and “reverse” contactors must never close at the same time, or phases short together. In Ladder, each rung carries an NC contact of the opposite output: the Q1 rung has Q2 (NC) in series, and the Q2 rung has Q1 (NC). Whichever turns on first blocks the other. A well-made program interlocks in software and in hardware (NC auxiliary contacts on the contactors themselves), just like the real panel.
Timers: TON, TOF and TP
A timer has a preset time and a Q output, which appears as a contact T1, T2…
- TON (on-delay): the output turns on after the input has stayed on for the preset time. If the input drops sooner, it resets. Example: wait 5 s before starting a second load.
- TOF (off-delay): the output turns on with the input and only turns off after the preset, counted from the moment the input drops. Example: keep the fan running 30 s after the light goes off.
- TP (pulse): a fixed-length pulse triggered by the rising edge of the input, no matter how long the input stays on.
The classic use of TON is star-delta starting: the program turns on the main and star contactors, the TON counts a few seconds, then drops star and pulls in delta.
Counters: CTU and CTD
- CTU (count up): adds 1 on each rising edge of the input; when it reaches the preset, the output turns on. Example: count boxes on a conveyor and trigger the diverter every 10.
- CTD (count down): starts at the preset and subtracts 1 on each rising edge; the output turns on at zero. Example: tracking a stock of parts.
To clear a counter, use a reset coil (-(R)-) pointing at its address.
How the PLC runs it: the scan cycle
The PLC endlessly repeats three steps: read all inputs and freeze a “snapshot” of them, solve the rungs from top to bottom, and only then write the outputs. Two practical consequences: rung order matters (a rung sees the result of the rungs above it in the same scan, and of the ones below it only from the previous scan), and an input that changes mid-cycle is only noticed in the next cycle.
Program in the browser, buying nothing
In the 4DVolt electrical workbench the PLC is a component like any other. The fastest way in:
- Open the workbench and go to File › Examples. Choose the 24 V DC direct-on-line start example with a PLC. The supply, PLC, pushbuttons and contactor come already assembled.
- Energize the workbench and flip the PLC switch from STOP to RUN. Without RUN the program does not execute.
- Hold the green pushbutton: input
I1lights up and the contactor closes. Release it and the seal-in keeps the motor on. The red pushbutton switches it off. - Double-click the PLC to open the Ladder editor. With the workbench in RUN, it shows power flowing through contacts and coils (in orange), the live value of each timer and counter, and a Force inputs button that lets you switch an input on or off without a pushbutton, to test every path in the program.
- To build your own, edit the program: pick the element on the toolbar, click a cell in the rung, set the address and preset. Use the parallel branch for the seal-in, and speed up the simulation clock to watch the timer count.
There are also reversing (with interlocking) and star-delta (with a TON) examples. In the star-delta one the workbench shows only the control side, the three contactors closing in sequence; the catalog motor has three terminals and does not represent the winding reconnection.
Limits and precautions
- It is a teaching simulator: good for learning the logic, not for validating a real machine.
- A rung has up to 8 columns, with contacts and blocks in the first seven and the coil in the last.
- Wiring, grounding, protection and sizing of a real machine must follow the applicable electrical codes and machine-safety rules and be done by a qualified professional.
See also: online electrical workbench: test circuits safely and circuit breaker vs. RCD vs. SPD.
A classic ladder example: the direct-on-line motor starter with a contactor, with seal-in and overload relay.
Create your free account.
This text is informational. The simulation is educational and does not replace the design, sizing under the applicable electrical standards, or execution by a qualified professional. Never work on energized installations without proper safety measures.
Frequently asked questions
What is Ladder logic?
It is a graphical PLC programming language, defined in IEC 61131-3, that looks like an electrical control schematic: contacts on the left, a coil on the right.
Do I need to buy a PLC to learn Ladder?
No. In the 4DVolt simulator you build the circuit, program the PLC in Ladder and watch it run in the browser, with no hardware or license.
What is seal-in logic?
It is an NO contact of the output itself in parallel with the start button, which keeps the coil on after the button is released. The stop button, in series, breaks the seal-in.
What is the difference between TON and TOF?
TON delays turning on: the output only turns on after the input has been on for the preset time. TOF delays turning off: the output stays on for the preset time after the input drops.
Read also
Direct-on-line motor starter with a contactor: control and power circuit
Understand the DOL starter: power and control, pushbuttons, seal-in and overload relay. Test it online and spin the motor both ways.
Online electrical workbench: test circuits safely
Assemble a breaker, RCD, switch and lamp on an already energized supply and watch short circuit, overload and leakage current happen with no danger.