23
(17
)
This function code performs a combination of one read operation and one write
dec
hex
operation in a single MODBUS transaction. The write operation is performed be-
Read/Write Mul-
fore the read operation. Holding registers are addressed starting at zero. This
tiple Register
means that holding registers 1-16 will be addressed in the PDU using 0-15.
The request PDU specifies the starting address and the number of holding regis-
ters to be read as well as the starting address, the number of holding registers,
and the data for the write operation. The byte count field specifies the number of
bytes to follow in the write data field. The normal response contains the data
from the group of registers read. The byte count field specifies the number of
bytes to follow in the read data field.
Request
Function code
Read starting ad-
dress
Number of registers
to read
Write starting ad-
dress
Number of registers
to write
Write number of
bytes
Write register values
N* = number of registers to be written
Response
Function code
Number of bytes
Write register values
N* = number of registers to be read
Error
Error code
Exception code
Example
Example request for reading six registers and writing three registers.
Request
Field Name
Transaction Identifier Hi
Transaction Identifier Lo
Protocol Identifier Hi
Protocol Identifier Lo
Length Hi
Length Lo
1 byte
17
hex
2 bytes
0000
hex
2 bytes
0001
hex
2 bytes
0000
hex
2 bytes
0001
hex
1 byte
2 x N*
N* x 2 bytes
1 byte
17
hex
1 byte
2 x N*
N* x 2 bytes
1 byte
97
hex
1 byte
01 or 02 or 03 or 04
Response
Hex
Field Name
00
Transaction Identifier Hi
01
Transaction Identifier Lo
00
Protocol Identifier Hi
00
Protocol Identifier Lo
00
Length Hi
11
Length Lo
Englisch (US)
to FFFF
hex
to approx. 0076
hex
to FFFF
hex
to approx. 0076
hex
Hex
00
01
00
00
00
0F
73