- 37 -
6.4.3
Function Code 16 (Write Multiple Holding Registers)
Function code 16 (0x10) is used to write a block of contiguous data to the specified multiple
registers.
Example of request message
The master sends function code = 16 (0x10) to the slave (unit ID = 03). “Test mode ON command”
and “test gas concentration” will be written to register addresses 40048 (relative address = 47
(0x002F)) and 40049 (relative address = 48 (0x0030)) respectively.
Test mode ON command = ON (0x0001)
Test gas concentration = 25%F.S. (0x0019)
Message frame
Modbus TCP
Modbus RTU
Remarks
Data item
Data
size
(byte)
No.
Byte
data
Hex
No.
Byte
data
Hex
TRXN ID Hi
2
(1)
0
0x00
–
–
–
Modbus TCP
only
Lo
(2)
0
0x00
–
–
–
Protocol
ID
Hi
2
(3)
0
0x00
–
–
–
Modbus TCP
only
Fixed at “00”.
Lo
(4)
0
0x00
–
–
–
Quantity
of comm.
data
Hi
2
(5)
11
0x00
–
–
–
Modbus TCP
only
Number of data
which follows
unit ID
Lo
(6)
0x0B
–
–
–
Unit ID
1
(7)
3
0x03
(1)
3
0x03
Function code
1
(8)
16
0x10
(2)
16
0x10
Starting
address
Hi
2
(9)
47
0x00
(3)
47
0x00
Write starting
register address
Lo
(10)
0x2F
(4)
0x2F
Quantity
of
registers
Hi
2
(11)
2
0x00
(5)
2
0x00
Quantity of
registers to be
written
Range: 1–123
Lo
(12)
0x02
(6)
0x02
Quantity of
data
1
(13)
4
0x04
(7)
4
0x04
Quantity of data
= N x 2 bytes
N: Quantity of
registers
Data1
Hi
2
(14)
1
0x00
(8)
1
0x00
Write data by
the word
Lo
(15)
0x01
(9)
0x01
Data2
Hi
2
(16)
25
0x00
(10)
25
0x00
Lo
(17)
0x19
(11)
0x19
Error
check
data
Lo
2
–
–
–
(12)
0x2A
Modbus RTU
only
Hi
–
–
–
(13)
0x45
Common to both Modbus TCP and Modbus RTU.