
Modbus RTU Function Codes
02/13 Modbus® RTU Serial Communications User Manual 21
3.7 Function Codes 16 (10h) – Preset Multiple Registers
Description
Presets values into a sequence of holding registers (4X references). When broadcasted, the function presets
the same register references in all attached slaves.
The specific supported registers available in an instrument via a Function Code 16 (10h) message may be
instrument-model specific. However, every instrument that supports the register assignments specified in
Appendix A with an access type “W”, supports writing to those specified registers via Function Code 16
(10h).
Query
The query message specifies the register references to be preset. Registers are addressed starting at zero:
Register 1 is addressed as 0.
Query message format for function code 16 (10h)
Slave
Address
Function
Code
Starting
Address
High
Start
Address
Low
Number
Addresses
High
Number
Addresses
Low
Byte
Count
Data CRC CRC
Example:
Preset Variable#1 (address 1880h) to 100.0 from a slave at address 02.
02 10 18 80 00 02 04 42 C8 00 00 CRC CRC
Response
The normal response returns the slave address, function code, starting address and the quantity of registers
preset.
The floating-point values require two consecutive addresses. A request to preset a single floating-point
value must be for two addresses. The byte order of the floating-point number is determined by the setting of
the byte swap configuration value. In this example the byte swap order is FP B. Refer to subsection 2.3. 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 Byte order is configurable See Subsection 0. If the master
station requests only one address at an address of a floating-point value the slave will respond with an illegal
data address exception (See Section 4) code.
Response message format for function code 16 (10h)
Slave
Address
Function
Code
Starting
Address
High
Start
Address
Low
Number
Addresses
High
Number
Addresses
Low
CRC CRC
Example:
Response from preset Constant #1 (address 1880h) to 100.0 from a slave at address 02.
02 10 18 80 00 02 CRC CRC
Comentarios a estos manuales