Explainer
What the PLC scan cycle does in each pass
Short answer
One scan is one complete pass: the PLC reads all inputs, executes the entire program once, then writes all outputs. Scan time is the time for that whole pass, not for one rung; small controllers typically finish a cycle in single-digit milliseconds. The pass order explains output lag, double-coil behavior and missed short pulses.
On this page
One scan is one complete pass through the controller: read every input, execute the entire program once, write every output. Scan time is the time that whole pass takes, not the time one rung takes, and on a small controller it typically lands in single-digit milliseconds. Everything odd about PLC behavior — outputs that lag a rung by a cycle, a second coil silently overwriting the first, a short pulse the logic never sees — follows from that pass order.
The four phases of one cycle #
A pass has four phases. First, the input read: the processor samples every physical input terminal once and copies the states into an input image in memory. Second, execution: the processor runs the whole user program top to bottom, and every contact instruction reads from that input image while every coil instruction writes to an output image, not to the terminals. Third, the output write: the completed output image is transferred to the physical output points all at once. Fourth, housekeeping: communications requests, self-diagnostics and timer updates that the vendor does not show you as rungs.
The order matters more than the phases. Because inputs are sampled once at the top, the program sees a snapshot of the machine, frozen for the duration of the pass. Because outputs are written once at the bottom, a coil state that lives for part of a pass never reaches a terminal.
What scan time measures #
Scan time is the wall-clock time of the entire pass: input read plus full program execution plus output write plus housekeeping. It is not the time for one rung, not the time a technician takes to enter the program, and not a communications deadline. For the small controllers that run a single machine, manufacturers generally document cycle times in single-digit milliseconds; larger programs, more I/O and heavy communications push it up.
A rung, by contrast, executes in microseconds. The gap between the two is the whole program length, which is why program size, not rung difficulty, dominates the cycle.
Example: scan time for a 100-rung program at 15 microseconds per rung #
These are illustrative figures in the range a small controller's documentation gives, not a rating for any specific model. Take a program of 100 rungs averaging 15 microseconds of execution each, an input read of 0.4 ms, an output write of 0.3 ms and housekeeping of 0.3 ms.
- Execution: 100 rungs × 15 microseconds per rung = 1500 microseconds = 1.5 ms.
- Whole pass: 1.5 ms + 0.4 ms + 0.3 ms + 0.3 ms = 2.5 ms per scan.
- Cycle rate: 1 ÷ 0.0025 seconds = 400 scans per second.
The decision this arithmetic gives you: any input condition that holds for at least 2.5 ms — one full pass — is guaranteed to appear in an input read, so the logic cannot miss it. Anything shorter is not guaranteed, and the fix is a high-speed counter or interrupt input, not more rungs. This is exactly why a PLC misses short input pulses and how to catch them matters on counts from fast sensors.
How the pass order shapes your ladder logic #
Write ladder logic knowing when each image updates:
- One input image per pass. Every contact of the same input in the program reads the same snapshot, so an input cannot change halfway through your logic and make two rungs disagree.
- Double coils: if the same output coil appears on two rungs, the last rung evaluated wins, and the earlier state exists only in memory for one pass. Physical outputs never show the intermediate state.
- Loops: a FOR loop runs all its iterations inside the execution phase of a single pass, which is why a FOR loop executes all iterations within one scan and the cycle stretches by the loop's full runtime, not one iteration.
- Timers and counters are instructions evaluated during execution, so their resolution is bounded by the cycle time, not by real time.
Ladder itself is the programmer-facing form of this execution: virtual relay contacts and coils, arranged on rungs between power rails, that the processor solves in order each pass. It behaves like relay logic on paper, but the evaluation is a software pass with the update timing above.
Where the program and working data live #
During a pass the processor works from RAM: fast, temporary memory holding the images, timer and counter values and the data registers the program needs immediately. RAM loses its contents without power, so controllers back the retentive ranges with a battery, capacitor or nonvolatile store, and keep the program itself in nonvolatile memory so the logic survives a power cycle. When a fault log shows retained values lost along with the program, you are looking at a failure of that retention path, not of the scan. One live example is a PLC-5 scan list that disappears after a power cycle, covered in why a PLC-5 loses its remote I/O scan list after power cycle.
Which devices sit on each side of the cycle #
The input read phase samples the input side: sensors, limit and level switches, pushbuttons, thermocouple and analog channels. The output write phase drives the output side: solenoid valves, indicator lamps, contactor and motor starter coils — the on/off loads wired to digital output points. A motor or lamp is never an input; it is actuated, so it lives downstream of the output image.
This is also where the speed comparison lands. A conventional hardwired relay system changes state through electro-mechanical coil and armature movement, typically tens of milliseconds per step, and every interlock is a physical contact in the wire path. A controller solving the same logic in single-digit-millisecond passes evaluates the whole chain each cycle, which is why relay panels were replaced: not because the logic differs, but because the pass runs orders of magnitude faster than moving contacts.
Safety interlocks that protect a person stay outside this discussion: an emergency stop circuit is hardwired so it removes power without depending on any pass of the program.
The decision, case by case #
- Programming: treat the input image as fixed for one pass and the output image as invisible until the write phase. Put a coil on exactly one rung, and let execution order carry your sequence instead of duplicating coils.
- Speed: total your expected rungs at their documented per-instruction times plus the fixed read, write and housekeeping slices, as in the example above. If the result stays comfortably below the fastest process change you must catch — the pulse must outlast one full pass — a scan-based input is fine.
- Short events: if the event can be shorter than one pass, move it to a high-speed counter, interrupt input or dedicated hardware; do not try to fix it in ladder.
Questions asked
How is response time different from scan time?
Scan time is only the controller's internal pass. Response time is what the machine sees: the input filter and wiring delay, plus up to one full scan while the new input state waits to be read, plus the output stage's turn-on delay. A change that arrives just after an input read waits almost a whole cycle before the logic sees it, then the output updates at the end of the following pass.
Does a bigger program always scan proportionally slower?
The execution phase scales with the number of instructions, so doubling the rungs roughly doubles that phase. It does not scale the input read, the output write or the housekeeping slice, which are close to fixed for a given controller and I/O count. Communications traffic, interrupt routines and unconditional jumps that skip whole blocks also move the real cycle away from a simple rung count times per-rung time.
Why does a coil driven by a fast pulse sometimes never turn on the output?
The rung sets the output image in memory, but the physical terminal updates only in the output write phase. If the pulse is gone before the next input read, no rung ever sees it and the image stays off. Catch such pulses with a high-speed counter or interrupt input, or extend the pulse in hardware so it lasts at least one full cycle.