Understanding Data Consistency - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Programming concepts

6.4 Understanding data consistency

You can store objects you want to reuse in libraries. For each project, there is a project
library that is connected to the project. In addition to the project library, you can create any
number of global libraries that can be used over several projects. Since the libraries are
compatible with each other, library elements can be copied and moved from one library to
another.
Libraries are used, for example, to create templates for blocks that you first paste into the
project library and then further develop there. Finally, you copy the blocks from the project
library to a global library. You make the global library available to other colleagues working
on your project. They use the blocks and further adapt them to their individual requirements,
where necessary.
For details about library operations, refer to the STEP 7 online Help library topics.
6.4
Understanding data consistency
The CPU maintains the data consistency for all of the elementary data types (such as Words
or DWords) and all of the system-defined structures (for example, IEC_TIMERS or DTL).
The reading or writing of the value cannot be interrupted. (For example, the CPU protects
the access to a DWord value until the four bytes of the DWord have been read or written.) To
ensure that the program cycle OBs and the interrupt OBs cannot write to the same memory
location at the same time, the CPU does not execute an interrupt OB until the read or write
operation in the program cycle OB has been completed.
If your user program shares multiple values in memory between a program cycle OB and an
interrupt OB, your user program must also ensure that these values are modified or read
consistently. You can use the DIS_AIRT (disable alarm interrupt) and EN_AIRT (enable
alarm interrupt) instructions in your program cycle OB to protect any access to the shared
values.
● Insert a DIS_AIRT instruction in the code block to ensure that an interrupt OB cannot be
executed during the read or write operation.
● Insert the instructions that read or write the values that could be altered by an interrupt
OB.
● Insert an EN_AIRT instruction at the end of the sequence to cancel the DIS_AIRT and
allow the execution of the interrupt OB.
A communication request from an HMI device or another CPU can also interrupt execution of
the program cycle OB. The communication requests can also cause issues with data
consistency. The CPU ensures that the elementary data types are always read and written
consistently by the user program instructions. Because the user program is interrupted
periodically by communications, it is not possible to guarantee that multiple values in the
CPU will all be updated at the same time by the HMI. For example, the values displayed on a
given HMI screen could be from different scan cycles of the CPU.
178
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents