The first scan bit and what belongs in it
One scan of initialisation, and a reliable way to make a machine start in a known state.
Short answer
The first scan bit is true for exactly one scan after the processor enters RUN, and false thereafter. It exists to give a program somewhere to initialise: clearing stale state, setting default values, and putting sequences back to a known step. Using it well is what makes a restart predictable.
Every platform gives you one scan where you know the program has just started. What you do with it determines whether a restart is predictable.
The names
Rockwell exposes S:FS. Siemens gives you a startup organisation block that runs once before the cyclic one. CODESYS platforms expose a first-cycle flag.
Different mechanisms, same idea.
What belongs there
- Clearing state that should not have survived: step numbers, in-progress flags, stale results.
- Setting defaults where nothing was stored.
- Putting sequences back to a known step rather than resuming mid-cycle.
- Clearing any output command that must require a deliberate restart.
The test: after a power cut, does the machine come back in a state somebody would predict? If the answer depends on what it was doing when the power went, the first scan is not doing enough.
What does not belong there
Anything that takes time. The first scan is a scan, and a long initialisation delays the first solve of the actual program. Move slow work into a sequence that runs over several scans.
Common questions
- What should go in the first scan of a PLC program?
- Clearing anything that should not survive a restart, setting default setpoints where none are stored, resetting sequences to a safe step, and clearing outputs that must not re-energise. Anything whose stale value would be misleading or dangerous belongs here.
- Is the first scan bit the same on every platform?
- The concept is universal, the name is not. Rockwell exposes S:FS, Siemens provides a startup organisation block that runs once before the cyclic OB, and CODESYS platforms expose a first-cycle flag. The mechanism differs; the intent does not.
Keep reading
- Safety
SIL or PL: which one does your machine need?
Two standards, two scales, and one machine. Which one applies, how they map to each other, and why the answer is usually ISO 13849.
- Safety
Categories B, 1, 2, 3 and 4, in plain terms
Five architectures, what a single fault does to each, and the practical wiring that goes with them.
- Safety
Safety relay or safety PLC: how to decide
One is a wiring decision, the other is a programming one. The count of safety functions, not the size of the machine, is what settles it.