55xGenComm1_29
13
Function 16 - Write Multiple Registers
Writes one or more 16 bit registers to the slave device, complying to the following rules:
1. The limit of 123 registers is to comply with the Modbus specification, which requires that a
message must not exceed 256 bytes including all fields.
2. A write to a register that is defined in this standard but not implemented on this slave device
will return extended exception 4 (Register not implemented) and have no other affect.
3. A write to a register that is defined in this standard as unimplemented will return extended
exception 4 (Register not implemented) and have no other affect.
4. A write to a register that is defined in this standard as containing some unimplemented bits will
only affect the implemented bits, the state of the unimplemented bits is irrelevant.
5. Attempts to write to a register that is defined as reserved in this standard will return extended
exception code 12 (Reserved register) and have no other affect.
6. A write to a multi-register value such as a 32 bit value, a password or a string must be
performed by a single message, not by multiple ones. This avoids the possibility of a value
being partly current and partly old data.
Query message
Byte Field
name
Notes
0 Slave
address
1
Function code (16)
2
First register address - high byte
16 bit register address
3
First register address - low byte
4
Number of registers to write - high byte
16 bit number of registers, must be in the
range 1 to 123
5
Number of registers to write - low byte
6
Byte count (n)
8 bit even number in the range 2 to 246
(number of registers *2)
7
First register - high byte
16 bit register
8
First register - low byte
…
5+n
Last register - high byte
16 bit register
6+n
Last register - low byte
7+n/8+n
Error check CRC
Normal response message
Byte Field
name
Notes
0 Slave
address
1
Function code (16)
2
First register address - high byte
16 bit register address
3
First register address - low byte
4
Number of registers written - high
byte
16 bit number of registers, must be in the range 1
to 123
5
Number of registers written - low byte
6 - 7
Error check CRC
Exception response message
Byte Field
name
Notes
0 Slave
address
1
Function code +128 (144)
Top bit is set
2
Exception code
1 - Illegal function code
2 - Illegal data address
6 - Slave device busy
3/4
Error check CRC