Data consistency of Boolean variables with absolute address
Question:
What has to be considered regarding data consistency when Boolean variables with absolute address (e. g. digital outputs) are applied?
Answer:
If the Boolean variables are in the same Byte, the access to Boolean variables with absolute address from different tasks can lead to data inconsistencies.
In case of write access to a Boolean variable with absolute address the processor of the PLC target system first reads the Byte where this Bit is located. For modification of the bits the Byte is correspondingly masked. Then the Byte is written back to the memory of the process image. In a multi-tasking environment this procedure can be interrupted. This means, if the writing process is interrupted by another task and if in this task one bit of this Byte is also written, data inconsistency will be the consequence. Example:
In the module PLC_PRG (cyclic task) the digital output A1 is written. In the module TASK_PRG, which is called by means of an internal task, the digital output A2 is written. Both outputs are in the same Byte, this means, if the interval task interrupts the cyclic task while the digital output A1 is written, data inconsistency will be the consequence.
From DDS version 2.2 on (DDS = Global Drive PLC Developer Studio) the data consistency of Boolean variables with absolute address is guaranteed. Condition: In the dialog Target settings (tab Resources) in tab target platform the switch data consistency for multi-tasking is activated (see Data consistency for multi-tasking; Doc-ID 200403230).