Modbus supported access

This page describes the data elements and data types supported by a Modbus driver.

Variables

The Modbus driver supports the following Modbus registers as device variables:

Variable Description
Coils Table region of read only single Bit variables.
Discrete Inputs Table region of readable and writeable single Bit variables.
Input Registers Table region of 16 bit (Word) read only variables.
Holding Registers Table region of 16 bit (Word) read and write variables.

Data types, data conversion and addressing

The Modbus driver supports the Modbus data types and their mapping to runtime data types as follows:

Modbus data type Size Runtime data type
Bit 1 Byte BOOL
Word 2 Bytes INT2
Unsigned Word 2 Bytes UINT2
Double Word 4 Bytes (Two Contiguous Words) INT4
Unsigned Double Word 4 Bytes (Two Contiguous Words) UINT4
Floating Point 4 Bytes (Two Contiguous Words) FLOAT4
Quad Word 8 Bytes (Four Contiguous Words) INT8
Unsigned Quad Word 8 Bytes (Four Contiguous Words) UINT8
Double Floating Point 8 Bytes (Four Contiguous Words) FLOAT8
String Multiple Contiguous Words of a predetermined length STRING

The Modbus data types are supported in the runtime environment wherever a variable is accessed and the variable is associated with a Modbus device. Some examples are:

  • From the Workbench > Devices > Variables tab Read and Write functions.

  • Transport map data type parameters
  • Trigger data type parameters
  • Trigger action variable data type parameters

The data representations in the Modbus device, the runtime and the Workbench are supported by the necessary data conversion functions (such as Words to Float4).

The variable addressing supports the assignment of a variable of one data type into a variable with a different data type at the correct starting address location. One way to see this variable addressing support is to use the Workbench > Devices > Variables tab Read and Write functions by right-clicking on a data element and reading or writing as a type different than the data element.

Nested Bool Access

Modbus driver supports the reading or writing of individual bits within a 16-bit data element of Holding Registers as shown in the below figure.

Limitations

  • Reading and writing String data into a contiguous group of 16 bit data elements is not supported.
  • Read and write data packet sizes are limited to 100 Words, or 200 bytes. The corresponding limit for reading two contiguous Words as either an INT4 or a FLOAT4, is 50 elements.
  • The generic Modbus Device type available from the Device window > Type parameter does not automatically determine the size of the Coil, Discrete Input, Input Register, and Holding Register tables. The size of these tables must be determined using either the data specification sheets or the configuration software provided by the hardware manufacturer.
  • The size and configuration of the data blocks cannot be modified for vendor specific Modbus device types that are available from the Device window >Type parameter.