Using CitectSCADA > Communicating with I/O Devices > Advanced Driver Information > Variable (digital) limitations

Variable (digital) limitations

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 CitectSCADA 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 CitectSCADA 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 CitectSCADA driver has read these same registers, but before CitectSCADA has written the modified value, the changes made by the PLC will be overwritten. This outcome can be avoided if CitectSCADA 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 CitectSCADA driver has read it, but before CitectSCADA 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 CitectSCADA 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 Citect 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:

  1. The initial state of a PLC register is 0x02h.
  2. The CitectSCADA driver reads the value of this register (effectively making a copy) in preparation for a change to bit 3.
  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.
  4. The CitectSCADA 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 CitectSCADA's read and write, these changes are overwritten.