Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

Ladder logic and logic gates: the same Boolean logic, drawn two ways

Ladder logic is a graphical language for programming PLCs (programmable logic controllers). IEC 61131-3, the standard for PLC programming languages, defines two textual languages, Instruction List and Structured Text, and two graphical ones, Ladder Diagram and Function Block Diagram. A ladder diagram looks like a ladder: two vertical power rails with horizontal rungs between them, each rung a row of input contacts ending in an output coil. It grew out of the wiring drawings for relay control panels, where a coil was energised when current found a path through closed contacts, which is why it is also called relay logic. Read as logic, contacts in series are AND, contacts in parallel are OR, a normally closed contact is NOT, and the coil is the output. A rung and a gate network can express the same Boolean function; the difference is who reads it and what runs it.

What ladder logic is good at

Ladder logic is easy for electricians and maintenance staff to read, because it looks like the wiring they already know: you can follow a rung left to right and see which contact is stopping the coil. It is built for machine control: interlocks, start and stop circuits, alarms and sequences, which a PLC evaluates over and over in a scan cycle. Gate-level logic is the hardware view: the same AND, OR and NOT realised as transistors that switch in nanoseconds, which is how the processor inside the PLC itself is built.

Where digiwleea fits

digiwleea is not a PLC or ladder simulator; it simulates the logic gates and transistors underneath. The idea that makes ladder logic work is the same one digiwleea teaches from its first lessons: switches in series conduct only when all are closed (AND), and switches in parallel conduct when any is closed (OR). In a CMOS gate those switches are NMOS and PMOS transistors, as in the CMOS NAND and NOR builds, and the logic as switches lesson starts there. A seal-in rung is a memory element, the job an SR latch does with two cross-coupled gates.

Ladder elements as logic

LadderLogicBoolean
Normally open contact AInput AA
Normally closed contact ANOT gateNOT A
Contacts A and B in seriesAND gateA AND B
Contacts A and B in parallelOR gateA OR B
Output coilOutputY = the rung's expression
Start in parallel with a Motor contact, in series with a normally closed StopLatch (reset wins)Motor = (Start OR Motor) AND NOT Stop

No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.

More comparisons: Digital logic concepts compared

See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.

Open the digiwleea lab →

Frequently asked

What is ladder logic?

A graphical way to write control logic for PLCs, drawn as rungs between two power rails, each rung a set of input contacts that energise an output coil when they form a closed path. It is one of the PLC languages defined in IEC 61131-3, where it is called Ladder Diagram.

How does ladder logic relate to logic gates?

They describe the same Boolean functions: contacts in series are an AND gate, contacts in parallel an OR gate, and a normally closed contact a NOT gate. Ladder logic is a program a PLC evaluates repeatedly; logic gates are hardware.

What are the programming languages in IEC 61131-3?

The standard defines two textual languages, Instruction List (IL) and Structured Text (ST), and two graphical languages, Ladder Diagram (LD) and Function Block Diagram (FBD).

What is a seal-in (latching) circuit in ladder logic?

A rung where a contact of the output coil is placed in parallel with the start button, so once the coil turns on it keeps itself on until a normally closed stop contact opens the rung: Motor = (Start OR Motor) AND NOT Stop. It is a latch, like an SR latch.

Is relay logic the same as ladder logic?

Ladder diagrams were first used to draw relay control circuits, so relay logic is the physical origin of ladder logic. A PLC runs the same kind of logic in software instead of with relays.