Modbus/TCP & Modbus RTU Function Codes
24 UDA2182 Communications User Guide January 09
8.4 Function Code 16 (10h) - Preset Multiple Registers
Description
Function code 16 presets values into a sequence of holding registers (also refered to as 4X references).
Broadcast is not supported.
Query
The query message specifies the register references to be preset. Registers are addressed starting at zero:
Register 1 is addressed as 0.
Example:
Preset Digital variable #1 (address 0008h) and Digital variable #2 (address 000Ah) to 1 in the
UDA at slave address 1.
Query message format for function code 16 (10h)
Slave
Address (00
for TCP)
Function
Code
Start
Address
High
Start
Address
Low
Number
Addresses
High
Number
Addresses
Low
Byte
Count
Data CRC
(RTU)
CRC
(RTU)
TCP
Example
00 10 00 08 00 04 08 00 00 00 01
00 00 00 01
RTU
Example
01 10 00 08 00 04 08 00 00 00 01
00 00 00 01
CRC CRC
Response
The normal response returns the slave address, function code, starting address and the quantity of registers
preset.
The analog and digital variables use double-registers. Analog variables are floating point values and digital
variables are 32-bit integer values. A request to preset a variable must be for two registers. The byte order
of the number is determined by the setting of the word swap configuration value. In this example the word
swap order is set to yes which is big endian. Refer to subsection 7.
For an analog variable, the first 16 bits of the response contain the IEEE MSB of the float value. The
second 16 bits of the response contain the IEEE LSB of the float value. The word order is configurable.
See Subsection 7.
Example:
Response from presetting digital variable #1 (address 0008h) and digital variable #2 (address
000Ah) from the UDA.
Response message format for function code 16 (10h)
Slave
Address (00
for TCP)
Function
Code
Start
Address
High
Start
Address
Low
Number
Addresses
High
Number
Addresses
Low
CRC
(RTU)
CRC
(RTU)
TCP Example 00 10 00 08 00 04
RTU Example 01 10 00 08 00 04 CRC CRC