Siemens 6AV6651-7KA01-3AA4 - S7-1200 + KTP400 Basic Starter Kit 6AV6651-7KA01-3AA4 User Manual

Product codes
6AV6651-7KA01-3AA4
Page of 364
PLC concepts made easy 
 
4.3 Execution of the user program 
 
Easy Book 
54
 
Manual, 03/2014, A5E02486774-AF 
The size of the user program, data, and configuration is limited by the available load memory 
and work memory in the CPU (Page 15). There is no specific limit to the number of each 
individual OB, FC, FB and DB block. However, the total number of blocks is limited to 1024. 
4.3.1 
Processing the scan cycle in RUN mode 
For each scan cycle, the CPU writes the outputs, reads the inputs, executes the user 
program, updates communication modules, and responds to user interrupt events and 
communication requests. Communication requests are handled periodically throughout the 
scan.  
These actions (except for user interrupt events) are serviced regularly and in sequential 
order. User interrupt events that are enabled are serviced according to priority in the order in 
which they occur. For interrupt events, the CPU reads the inputs, executes the OB, and then 
writes the outputs, using the associated process image partition (PIP), if applicable. 
The system guarantees that the scan cycle will be completed in a time period called the 
maximum cycle time; otherwise a time error event is generated. 
●  Each scan cycle begins by retrieving the current values of the digital and analog outputs 
from the process image and then writing them to the physical outputs of the CPU, SB, 
and SM modules configured for automatic I/O update (default configuration). When a 
physical output is accessed by an instruction, both the output process image and the 
physical output itself are updated. 
●  The scan cycle continues by reading the current values of the digital and analog inputs 
from the CPU, SB, and SMs configured for automatic I/O update (default configuration), 
and then writing these values to the process image. When a physical input is accessed 
by an instruction, the value of the physical input is accessed by the instruction, but the 
input process image is not updated. 
●  After reading the inputs, the user program is executed from the first instruction through 
the end instruction. This includes all the program cycle OBs plus all their associated FCs 
and FBs. The program cycle OBs are executed in order according to the OB number with 
the lowest OB number executing first. 
Communications processing occurs periodically throughout the scan, possibly interrupting 
user program execution.  
Self-diagnostic checks include periodic checks of the system and the I/O module status 
checks. 
Interrupts can occur during any part of the scan cycle, and are event-driven. When an event 
occurs, the CPU interrupts the scan cycle and calls the OB that was configured to process 
that event. After the OB finishes processing the event, the CPU resumes execution of the 
user program at the point of interruption.