Controls playground

Ladder logic

Ladder logic is how a lot of plant equipment is still programmed. It reads like an electrical drawing: power flows from the left rail, through contacts, to a coil on the right. Press the buttons below and watch it happen.

A teaching sandbox, not a real controller. Nothing here talks to equipment, and it is no substitute for a qualified controls engineer.

How a scan works

A PLC does not watch every wire at once. It runs the same loop over and over, many times a second:

  1. Read inputs. It takes a snapshot of every button and switch.
  2. Solve the rungs, top to bottom. Each rung is worked left to right using that snapshot. A coil set on rung 1 is already on by the time rung 2 is solved.
  3. Write outputs. Motors, lamps and valves get the results, then it starts again.

Here one scan runs every 100 milliseconds. Stop the processor and use Single scan to step through it. A button you tap between scans is still caught on the next one.

The parts

Normally open contact
Passes power when its tag is on. A pushbutton you have to press.
Normally closed contact
Passes power when its tag is off. Pressing Stop opens it and breaks the rung.
Output coil
On while its rung is true, off as soon as it is not.
Latch and unlatch coils
Latch turns a tag on and leaves it on. Only an unlatch coil turns it back off.
TON timer
Counts up while its rung is true. When the accumulated time reaches the preset, its done bit (DN) turns on. If the rung goes false, it resets to zero.
CTU counter
Adds one each time its rung goes from false to true. DN turns on at the preset. A RES coil clears it.
Parallel branch
Two paths side by side, an OR. Power gets through if either path is closed. That is how a seal-in holds a motor on after you let go of Start.

I have spent 20+ years in design and PLC/DCS systems, and this is the kind of thing I wish I had been able to play with when I was starting out. Edits you make are saved in this browser only.