Learning library

What is ladder logic?

Understand ladder diagrams, contacts, coils and scan cycles, then run your first input-to-output program in a browser.

A program drawn as rungs

Ladder logic expresses control conditions in a diagram inspired by relay circuits. Two vertical rails frame horizontal rungs. Read a rung from the conditions on the left toward the output on the right. A complete logical path makes that rung true; it is a representation of program logic rather than current physically flowing through the screen.

A contact reads a Boolean variable. A normally-open instruction passes when the variable is true; a normally-closed instruction passes when it is false. A coil writes the resulting condition to an output or internal bit. For the simplest example, one Switch contact controls one Lamp coil, so Lamp follows Switch on each evaluated scan.

Combine conditions with paths

Two contacts in series require both conditions, which is AND. Two parallel branches provide alternative complete paths, which is OR. For example, two series buttons require both inputs to light a lamp. With the buttons on parallel branches, either input is sufficient, and both together also light the lamp.

The physical contact type of a button does not dictate the ladder instruction. A physical NC Stop can produce a StopOK bit that is true while released. A NO program instruction then checks that healthy condition. Always establish what the bit means before choosing whether to read it directly or invert it.

The scan makes the diagram execute

The diagram is evaluated repeatedly. PLC Practice Lab uses a fixed 20 ms logic scan: read inputs, evaluate rungs top to bottom, update outputs and then the simulated device. Writes are visible to later rungs in the same scan. A paused diagram does not evaluate new input conditions until execution resumes.

Memory changes what you can express. A holding branch can keep a motor running after Start is released. TON measures a sustained true condition; CTU counts false-to-true events. Begin with ordinary contacts and coils, then add these instructions one at a time so you can explain which state is being stored.

Read, predict, then run

Before clicking Run, predict the initial output and what happens on press and release. Compare that prediction with the input values, highlighted path and output value. If they disagree, inspect the binding of each symbol before adding more logic. A correct drawing connected to the wrong variable still produces the wrong behavior.

Start with Lamp Follow below. Then compare AND and OR using the same four input combinations. This small progression gives you a working vocabulary for the longer motor, timer and sequencing examples.

Practice this lesson

Each walkthrough includes a reference diagram and a link to its editable simulator. Review the simulation limitations when comparing results with another environment.

Continue learning