Common MODBUS functions • 291
Function code FC16 (Write multiple registers)
Modular I/O System
ETHERNET TCP/IP
6.2.9
Function code FC16 (Write multiple registers)
This function writes values in a number of output words (also ”Output regis-
ter”).
Request
The first point is addressed with 0.
The inquiry message determines the registers to be set. The data is sent as 2
bytes per register.
The example shows how data is set in the two registers 0 and 1:
Byte
Field name
Example
Byte 0, 1
Transaction identifier
0x0000
Byte 2, 3
protocol identifier
0x0000
Byte 4, 5
length field
0x000B
Byte 6
Unit identifier
0x01 not used
Byte 7
MODBUS function code
0x10
Byte 8, 9
reference number
0x0000
Byte 10, 11
Word count
0x0002
Byte 12
Byte Count
0x04
Byte 13, 14
Register Value 1
0x1234
Byte 15, 16
Register Value 2
0x2345
Response
Byte
Field name
Example
.....
Byte 7
MODBUS function code
0x10
Byte 8, 9
Reference number
0x0000
Byte 10, 11
Register Value
0x0002
Exception
Byte
Field name
Example
.....
Byte 7
MODBUS function code
0x85
Byte 8
Exception code
0x01 or 0x02