Variable (Digital) Limitations
- Last UpdatedJul 18, 2023
- 3 minute read
Devices often have memory areas that are of a designated data type, like Byte, Integer, or Word. Some protocols do not support the reading and writing of data in these memory areas using a different data type. This situation is most common in the case of reading and writing of individual bits within the data types like Bytes, Integers, and Words.
In this case, reading individual bits within these larger data types is done by reading the designated data type and getting the Plant SCADA driver to sub-divide it into individual bits. Writing to bits within the larger data types is more complicated, as writing to one bit within the larger data type will at the same time overwrite the other bits within that same data type. To prevent overwriting existing bits when writing a new bit value, a 'read-modify-write' scenario can be used to write to a bit within the larger data type. Using this approach, the Plant SCADA driver will read the larger data type, modify the appropriate bit within the larger data type, and then write the larger data type back to the device.
While the 'read-modify-write' approach is necessary to avoid overwriting existing bits in the registers of larger data types, it can create an issue if the device being written to is also configured or programmed to modify these same registers. For example, if a PLC device modifies the registers of one of its larger data types after the Plant SCADA driver has read these same registers, but before Plant SCADA has written the modified value, the changes made by the PLC will be overwritten. This outcome can be avoided if Plant SCADA and any devices using these data types are configured so that only one or the other has write access at any given time.
This 'read-modify-write' method has a serious operational concern: if the device modifies the larger data type after the Plant SCADA driver has read it, but before Plant SCADA has written the new value, any changes made by the device are overwritten. This issue could be serious in a control system, and it is recommended that the device and Plant SCADA be configured so that only one of these systems writes to the data types of this kind.
|
|
|
UNINTENDED EQUIPMENT OPERATION When the read-modify-write method will be used to alter a data type's bit values, configure your system so that Plant SCADA and the host device do not have simultaneous write access to the affected memory ranges. Failure to follow these instructions can result in death, serious injury, or equipment damage. |
Consider the following example:
-
The initial state of a PLC register is 0x02h.
-
The Plant SCADA driver reads the value of this register (effectively making a copy) in preparation for a change to bit 3.
-
However, before the driver writes its change back to the PLC, the PLC code changes the value of bits 0 and 4 of this register to 0x13h.
-
The Plant SCADA driver then changes bit 3 of its copy of the register to 0x0Ah. When it writes to the PLC, it overwrites the PLC's copy of the whole register (not just the changed bit). Because the PLC code modified bits 0 and 4 in the interval between Plant SCADA's read and write, these changes are overwritten.
