PLC concepts
4.1 Execution of the control logic
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
71
4.1.1
Reading the inputs and writing to the outputs
Reading the inputs
Digital inputs:
Each scan cycle begins by reading the current value of the digital inputs and
then writing these values to the process image input register.
Analog inputs:
The CPU does not read the analog input values as part of the normal scan
cycle. Instead, an analog value is read immediately from the device when your program
accesses the analog input.
Writing to the outputs
Digital outputs:
At the end of every scan cycle, the CPU writes the values stored in the
process-image output register to the digital outputs.
Analog outputs:
The CPU does not write analog output values as part of the normal scan
cycle. Instead, the analog outputs are written immediately when your program accesses the
analog output.
4.1.2
Immediately reading or writing the I/O
The CPU instruction set provides instructions that immediately read from or write to the
physical I/O. These immediate I/O instructions allow direct access to the actual input or
output point, even though the image registers are normally used as either the source or the
destination for I/O accesses. The corresponding process image input register location is not
modified when you use an immediate instruction to access an input point. The corresponding
process image output register location is updated simultaneously when you use an
immediate instruction to access an output point.
Note
When you read an analog input, the value is read immediately. When you write a value to an
analog output, the output is updated immediately.
It is usually advantageous to use the process image register rather than to directly access
inputs or outputs during the execution of your program. There are three reasons for using the
image registers:
●
The sampling of all inputs at the start of the scan synchronizes and freezes the values of
the inputs for the program execution phase of the scan cycle. The outputs are updated
from the image register after the execution of the program is complete. This provides a
stabilizing effect on the system.
●
Your program can access the image register much more quickly than it can access I/O
points, allowing faster execution of the program.
●
I/O points are bit entities and must be accessed as bits or bytes, but you can access the
image register as bits, bytes, words, or double words. Thus, the image registers provide
additional flexibility.