Read/Write Memory - Write Multiple Registers Command (16)
Function Code 16
The Write Multiple Registers command (Function Code 16) writes data to one or more consecutive registers using a standard, variable-length Modbus frame. Unlike Function Codes 06, 30, and 31 — each fixed to one specific data width — Function Code 16 can write Int16 (1 register), Float32 (2 registers), or Int64 (4 registers) values, matching whatever width the target parameter requires. Data type ranges match those described under Function Codes 06, 30, and 31. Examples: Set A15 Damping to 10, A18 Low Flow Cutoff to +5.5, or C04 Dosing Target to 999,999,999.
Read/Write Memory – Write Multiple Registers Command (16) Format


Modbus RTU Read/Write Memory – Write Multiple Registers Command (Function Code 16)
Example 1 — 16-bit: A15 Damping
This example shows the master using Function Code 16 to write 10 to the parameter “A15 Damping”.
According to the Read/Write Memory List:
Starting Address: 00 12
Register Length: 1
Data Type: Int16
1. Value Conversion and Data Preparation (Hex Data)
Convert the decimal value 10 to Int16 (Big Endian) format.
The resulting 2-byte data is:: 00 0A。
2. Master Sends Write Command (TX Frame)
The master uses Function Code 16 with a Byte Count of 02, writing 4 data bytes to two registers starting at address 00 15.
Slave Address:
01Function Code:
16(0x10)Starting Register Address:
00 12(A15 Damping)Quantity of Registers:
00 01Byte Count:
02Written Data:
00 0A(10 in decimal)CRC:
25 25(calculated CRC)
3. Slave Response (RX Frame)
When the write command is successful, the master receives a response from the slave as confirmation.
Slave Address:
01Function Code:
16(0x10)Starting Register Address:
00 12(A15 Damping)Quantity of Registers Written:
00 01CRC:
A1 CC(calculated CRC)
Once the master receives the RX frame and verifies that the Starting Register Address, and Quantity of Registers Written are correct, it confirms that A15 Damping has been successfully set to 10.
Example 2 — 32-bit: A18 Low Flow Cutoff
This example shows the master using Function Code 16 to write +5.5 to the parameter “A18 Low Flow Cutoff”.
According to the Read/Write Memory List:
Starting Address: 00 15
Register Length: 2
Data Type: : Float32
1. Value Conversion and Data Preparation (Hex Data)
Convert the decimal value +5.5 to Float32 (Big Endian) format.
The resulting 4-byte data is:: 40 B0 00 00。
2. Master Sends Write Command (TX Frame)
The master uses Function Code 16 with a Byte Count of 04, writing 4 data bytes to two registers starting at address 00 15.
Slave Address:
01Function Code:
16(0x10)Starting Register Address:
00 15(A18 Low Flow Cutoff)Quantity of Registers:
00 02Byte Count:
04Written Data:
40 B0 00 00(+5.5 in Float32)CRC:
26 BB(calculated CRC)
3. Slave Response (RX Frame)
When the write command is successful, the master receives a response from the slave as confirmation.
Slave Address:
01Function Code:
16(0x10)Starting Register Address:
00 15(A18 Low Flow Cutoff)Quantity of Registers Written:
00 02CRC:
50 0C(calculated CRC)
Once the master receives the RX frame and verifies that the Function Code, register address, and number of registers written are correct, it confirms that A18 Low Flow Cutoff has been successfully set to +5.5.
Last updated