The scan cycle in simple terms
In a typical cyclic execution, the CPU samples inputs configured for automatic update into the input process image. It then executes the user program and stores logic results in the output process image. During output update, those values are transferred to physical output channels. Exact sequencing and communication servicing depend on the CPU family and configuration.
For example, a part-present sensor is wired to a digital input. The CPU samples the input, evaluates the logic and places a motor command in the output image if the required conditions are met. The physical output is updated as part of the cycle, so an input change does not necessarily change the output at that exact instant.
What is the process image and why does it matter?
The process image is a CPU memory area containing a snapshot of input and output states used by the user program. It provides consistency: the cyclic logic works with a stable set of sampled inputs, while output values are calculated in memory before being transferred to physical channels.
Some applications require direct I/O access or assigning I/O to a process-image partition. This should be deliberate and based on the CPU documentation; direct access is not a universal, cost-free replacement for cyclic process-image handling.
Scan time and what affects it
Scan time is the time required for a CPU cycle. Instruction count, calculation complexity, called blocks, communication processing, interrupts and data access can all affect it. Scan time is not necessarily constant and should be measured on the actual application.
The CPU configuration typically provides a maximum cycle-time limit. Exceeding it can trigger a time-error event, with CPU behavior depending on configuration and available OB handling. Unbounded loops and heavy calculations should therefore be evaluated for execution-time impact.
Interrupts: Cyclic versus event-driven execution
Not all logic has to run in OB1. Other OBs can be triggered by events such as time interrupts, hardware events or diagnostic conditions, depending on CPU support. This is useful when an event should not simply wait for the next main-cycle pass.
Interrupt design must account for execution priority, processing time, event overlap and impact on the main cycle. An interrupt does not remove timing constraints; long or frequent interrupt routines can affect other tasks.
Practical programming and troubleshooting notes
For ordinary machine logic, a modular cyclic structure is usually appropriate. For fast pulses, counting or precise timing, use suitable hardware features such as HSC or supported interrupts; edge detection in a normal scan may miss short pulses.
During troubleshooting, inspect cycle time, diagnostic buffer, OB status, I/O update behavior and the difference between online values and actual field behavior. If an output is delayed, isolate whether the cause is CPU cycle time, input filtering, network, drive, actuator or mechanical process.
Key takeaways
- A typical cycle samples inputs, executes logic and updates outputs.
- The process image provides a stable I/O snapshot for cyclic logic.
- Scan time varies; fast signals may require dedicated hardware functions.
Need help applying this in a real project?
Explore Elecnic engineering services for Siemens PLC programming and troubleshooting, HMI/SCADA implementation, SINAMICS drive integration and commissioning support.
References and further reading
This is an original Elecnic article based on the technical references below. Always verify model-, firmware- and software-version-specific details in the official documentation for your equipment.
