PLC Scan Cycle: Input Read, Program Execution and Output Update
“The PLC runs top to bottom” is only part of the picture. You also need to know when inputs are sampled and when outputs are updated.
Think of one scan in three stages
A useful learning model is read inputs → execute program → update outputs. Real CPUs can include additional tasks and services, but this model explains most beginner-level timing questions.
Instruction order inside the program also matters
If an early rung MOVs a new value into a D register and a later rung compares that same register, the later rung can see the updated value during the same program execution. Many “same condition, different result” bugs are really scan-order bugs.
Physical input and program image are not identical concepts
The field contact can change at any instant, while the normal program works from a sampled input state. Very short pulses may therefore require high-speed input or interrupt functions instead of normal scan logic.
Debug in this order
- Find where the condition is first changed
- Check whether the same M/D device is written in multiple places
- Check duplicate output coils
- Compare signal pulse width with scan behavior
- Understand how online monitoring refresh relates to execution