Understanding Data Consistency - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

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
● Insert the instructions that read or write the values that could be altered by an interrupt
● Insert an EN_AIRT instruction at the end of the sequence to cancel the DIS_AIRT and
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.
The PtP (Point-to-Point) instructions, PROFINET instructions (such as TSEND_C and
TRCV_C), PROFINET Distributed I/O instructions (Page 441) , and PROFIBUS Distributed
I/O Instructions (Page 451) transfer buffers of data that could be interrupted. Ensure the data
consistency for the buffers of data by avoiding any read or write operation to the buffers in
both the program cycle OB and an interrupt OB. If it is necessary to modify the buffer values
for these instructions in an interrupt OB, use a DIS_AIRT instruction to delay any interruption
(an interrupt OB or a communication interrupt from an HMI or another CPU) until an
EN_AIRT instruction is executed.
Note
The use of the DIS_AIRT instruction delays the processing of interrupt OBs until the
EN_AIRT instruction is executed, affecting the interrupt latency (time from an event to the
time when the interrupt OB is executed) of your user program.
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
executed during the read or write operation.
OB.
allow the execution of the interrupt OB.
99BProgramming concepts
6.4 Understanding data consistency
143

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents