Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Interface for Modbus Ethernet PLC

Tag groups

  • Last UpdatedNov 17, 2022
  • 2 minute read

Due to the functionality of the Modbus application protocol, a single write request can update the values in up to 1,968 tags. The table below lists the maximum number of coils or registers that may be written to with a single request:

Function Code

Description

Maximum Quantity

5

Write Single Coil

1 coil

6

Write Single Register

1 register

15

Write Multiple Coils

1968 coils

16

Write Multiple Registers

123 registers

Since function codes 5 (write to a single coil) and 6 (write to a single holding register) will use a Modbus request to update only one value in a remote device, this section primarily deals with multiple write function codes 15 and 16. Except for cases in which a single unique data value is to be written, it is advantageous for the user to configure output tags to use function codes 15 and 16.

To enhance performance by maximizing the use of a single request for writing data, the interface will place tags in groups based on the Ethernet node, PLC node (location2), function code (location3) and data type (location3) being equal and the data offset (location5) being within a range of contiguous offsets based on the maximum quantity of values that can be written in a request. Given that the Modbus application protocol allows for a maximum of 246 bytes of data in a write request, the following formula is used to compute the maximum number of register values that may be written in a single request (since coils are bits, the maximum number is fixed at 1,968 coils):

Maximum Quantity = 246 / (Registers per data type * 2 bytes per register)

For example, since data type 1 (16-bit integer) is represented in a single register the maximum quantity of values registers that can be written to by a single request is 123. On the other hand, since data type 7 (4-byte integer) is represented in two registers the maximum quantity of values in registers that can be written to by a single request is 61 (in this case the maximum quantity is rounded down so that the total number of bytes does not exceed 246).

Unlike the tag groups of input tags, the data offset range for a group of output tags is not predetermined by the interface. Because the multiple write function codes 15 and 16 require contiguous data offsets, the interface will automatically create output tag groups for related tags with contiguous offsets. The only limitation for an output tag group is that the number of tags cannot exceed the maximum number of register values that may be written in a single request. For example, if the user creates 200 output tags of data type 1 with contiguous offsets the interface will create two tag groups since the maximum quantity of values that can be written is 123.

Related Links
TitleResults for “How to create a CRG?”Also Available in