Loading local progress…
Get started
Practise in
Level 1, 0 XP · your progress
All chapters
Chapter 10 of 12: show all chapters

Chapter 10 of 12Part 3: Writing the rules · 4 min

The PLC scan: checking again and again

A PLC does not read your rules once. It reads them again and again, about 50 times every second. This loop is called the scan.

Read, decide, write, repeat

  • Read: the PLC takes a snapshot of every input.
  • Decide: it follows your rules from top to bottom.
  • Write: it sends the results to the outputs.
  • Then it starts again, straight away.

Why so often?

Because things keep changing. If the PLC only checked once a minute, a tank could overflow before it noticed. Checking about 50 times a second means it reacts faster than you can blink.

On this site, one scan takes 20 milliseconds. A millisecond is a thousandth of a second, so that is 50 scans every second.

Why it matters for your code

PumpOn := Start; does not run just once, when you press the button. It runs on every scan. So the moment you let go, the very next scan sees that Start is FALSE and stops the pump.

Try it

Watch the scan slowly, then hold Start. See which step notices first. Then switch to full speed.

Scan 1
  1. 1. ReadTake a snapshot of every input.Start was FALSE
  2. 2. DecideFollow the rule.PumpOn := Start;So PumpOn is FALSE
  3. 3. WriteSend the result to the pump.Pump told FALSE

Pump stopped

In slow motion, see how the pump only changes after the Read, Decide and Write steps have all happened.

New words

Scan
One trip round the loop: read the inputs, follow the rules, write the outputs.
Millisecond
A thousandth of a second. Written ms.

Quick check

How often does the PLC follow your rules on this site?