Modbus FC16 (Write Multiple Registers)
Function code 16 writes multiple holding registers in a single request, setting a block of sixteen-bit values at once. It is the code to use whenever a value spans more than one register or several parameters must be set together. This reference explains the FC16 request format, its confirmation response, and why it is the correct way to write a 32-bit value without a torn intermediate state.
Modbus Function Code 16 Write Multiple Registers in one line: Modbus function code 16 writes multiple holding registers in one request. It carries a starting register address, a quantity, a byte count, and the register values, two bytes each, high byte first. On success the device replies with just the starting address and the quantity written. Because it writes the whole block atomically, it is the safe way to set a 32-bit value that spans two registers.
How FC16 Writes a Register Block
Function code 16 carries a starting register address, a quantity of registers to write, a byte count equal to twice the quantity, and then the register values, two bytes each, most significant byte first. The device writes every register in the block and, on success, replies with only the starting address and the quantity written, since echoing all the data back would waste bandwidth. Matching that address and count to the request confirms the write.
The key property is that FC16 applies the whole block in one operation. Writing a 32-bit float or long, which occupies two consecutive registers, in a single FC16 request means the device never sees a half-updated value the way it might if you wrote each register with a separate function code 06. The two-register layout that FC16 protects is described in the 32-bit float across two registers reference.
FC16 Versus FC06 and Its Register Limit
Function code 06 writes one register; function code 16 writes many. Choose FC16 whenever the value is wider than sixteen bits or when several parameters must land together, and FC06 for a genuinely single-register change. The full trade-off, including drivers that always use one or the other, is examined in the Modbus FC16 vs FC6 reference.
One FC16 request writes at most 123 registers, a slightly lower ceiling than the 125-register read limit because the write request also carries the byte count and data within the same protocol data unit. Asking to write more returns an illegal data value exception, so large parameter blocks are written in chunks. As with every register write, FC16 reaches only holding registers, and a range that includes a read-only or nonexistent register is rejected as a whole rather than partially applied. The addressing that governs which registers exist is in the Modbus register addressing reference.
Frequently Asked Questions
How many registers can FC16 write in one request?
Up to 123 sixteen-bit registers per request. That is slightly lower than the 125-register read limit because the write request must also fit its byte count and register data inside the same maximum protocol data unit. Writing more than 123 registers returns an illegal data value exception, so larger blocks are split into multiple FC16 requests.
Why is FC16 safer than two FC06 writes for a 32-bit value?
A 32-bit value spans two registers. Writing them with two separate FC06 requests means the device can read the pair between the two writes and see a half-updated, meaningless number. FC16 writes both registers in one atomic operation, so the device never observes a torn intermediate value. That is why FC16 is preferred for anything wider than sixteen bits.
How does a device confirm an FC16 write?
It replies with the starting register address and the quantity of registers written, not the data. Matching that to the request confirms success. An exception response instead means the range was rejected, most often because it includes a register that does not exist or is read-only, in which case none of the block is written.
Sources and verification
This page references the protocol specifications published by the organizations below. Editions, product capabilities, and documentation change over time - confirm current requirements and specifications directly with the source.
- Modbus Application Protocol Specification - Modbus Organization
Merobix is not affiliated with, endorsed by, or sponsored by these organizations; their names are used only to identify the standards and products discussed.
Automation services
Need help turning this into a working system?
Merobix integrates SCADA, programs Allen-Bradley and Siemens PLCs, and designs and fabricates industrial control panels.
Meeting requests are reviewed before confirmation.