Modbus FC06 (Write Single Register)
Function code 06 writes a single holding register, setting one sixteen-bit value such as a setpoint or a command word. It is the simplest write on the register side and the code most drivers use for a one-shot change. This reference explains the FC06 request and its echo response, and when a multiple-register write is the right choice instead.
Modbus Function Code 06 Write Single Register in one line: Modbus function code 06 writes a single holding register, setting one sixteen-bit value. The request carries the register address and the two-byte value to write, and on success the device echoes the request back unchanged as its acknowledgment. It writes only the holding-register table; input registers are read-only and coils are bits, so neither is a valid FC06 target.
The FC06 Request and Echo Response
Function code 06 carries a register address and a single sixteen-bit value, high byte first. The device writes that value into the named holding register and, on success, echoes the entire request back unchanged, so the response mirrors the address and value that were sent. Matching the echo to the request is how a master confirms the write took effect, and an exception response instead means the address or value was rejected.
Because FC06 writes exactly one register, a value wider than sixteen bits cannot be written with it in a single request; a 32-bit float spans two registers and needs a two-register write to avoid a torn value. The way multi-register values are laid out is covered in the 32-bit float across two registers reference, and the general place of FC06 among the write codes is in the Modbus function code overview.
FC06 Versus FC16 for Multi-Register Writes
Function code 06 writes one register; function code 16 writes multiple registers in one request. The choice matters when a value spans two registers or when several parameters must be set together. Writing the two halves of a 32-bit value with two separate FC06 requests risks a transient torn state where the device sees a half-updated number between the two writes. FC16 writes both halves atomically and avoids that. The trade-off between the two is examined in the Modbus FC16 vs FC6 reference.
As with all writes, FC06 only reaches holding registers. Aiming it at an input register fails because that table is read-only, and aiming it at a coil fails because coils are single bits with their own write codes. If an FC06 write returns an illegal data address exception on a register you believe exists, the likely causes are an addressing-base mismatch or a read-only register, both of which the Modbus register addressing reference helps rule out.
Confirming the Write Took Effect, Not Just Arrived
The FC06 echo confirms the device accepted the write, but acceptance and effect are different things. Devices legitimately clamp a written value to an internal limit, apply scaling, or let their own logic overwrite the register on the next program scan - a setpoint register that the running program continuously rewrites from its own source is the classic case, where every write succeeds and none of them stick. The robust pattern is write, then read back with a function code 03 read a moment later, then compare in engineering units, and alarm on a mismatch instead of assuming the echo settled the question.
The read-back also catches the subtler scaling mismatch. A raw value R only means what both ends agree it means: if the engineering value is E with scale factor S and offset O, the master computes R as (E minus O) times S and the device applies the inverse when using the value. If the two ends disagree on S or O, every write lands cleanly and every read-back disagrees in engineering units, which is precisely the disagreement the comparison exists to expose.
Reading the Failure: A Response Table for FC06
Each way an FC06 transaction can end points at a different fault, so the response is worth reading rather than collapsing into a generic failure flag:
| Outcome | Meaning |
|---|---|
| Echo matches the request | Write accepted; verify the effect with a read-back |
| Exception 02, illegal data address | No writable register at that address - often an addressing-base mismatch or a read-only register |
| Exception 03, illegal data value | Value outside the range the device permits for that register |
| Exception 06, device busy | Transient; back off briefly and retry the identical request |
| Timeout, no response | Link, addressing, or device availability problem, not a write problem |
The full failure vocabulary is catalogued in the exception code reference; the point here is that FC06 failures split cleanly into fix the request, fix the value, wait, and fix the link, and the response tells you which.
Writes Deserve Change Control
A register write is a command to real equipment, and it deserves more ceremony than a read. Good practice restricts which master, and which people, can write at all; logs every write with who, what, when, and the before and after values; and treats each newly writable register mapping as a change reviewed under the site's management-of-change process. The receiving device should also defend itself: range checks and interlocks belong in the device or its controller, so that an out-of-range or out-of-sequence command is rejected locally rather than trusted simply because it arrived over the network.
Decisions about writing to running process equipment - which setpoints are remotely writable, what limits apply, and what happens on a bad value - are made by qualified personnel under the site's procedures. The protocol delivers the two bytes; everything that makes the write safe lives around it.
Frequently Asked Questions
How does a device acknowledge an FC06 write?
By echoing the request back unchanged: the same register address and the same sixteen-bit value. The master confirms success by matching that echo to what it sent. If an exception response returns instead, the write was rejected, usually because the address does not exist, the register is read-only, or the value is out of the device's allowed range.
Can FC06 write a 32-bit value?
Not in one request. FC06 writes a single sixteen-bit register, while a 32-bit float or long occupies two registers. Writing the two halves with two separate FC06 requests risks a torn value the device reads mid-update. Function code 16 writes both registers atomically and is the safer choice for any value wider than sixteen bits.
Why does FC06 fail on an input register?
Input registers are read-only, so no write function code can reach them, and FC06 returns an exception. Only holding registers are writable. If a value you expected to set lives in the input-register table, the device does not intend it to be written, and you need to find the corresponding holding register or a different mechanism to change it.
Why does an FC06 write echo success but the register reads back unchanged?
Because the echo only confirms acceptance. The most common cause is device logic rewriting the register every scan from its own internal source, so the written value lands and is immediately replaced. Other causes are clamping to an internal limit and a scaling mismatch that makes the stored raw value read back as a different engineering value. A read-back comparison a moment after the write, done in engineering units, distinguishes these from a genuinely failed write.
Should a driver use FC06 or FC16 when writing just one register?
Functionally either works: FC16 with a count of one also writes a single register. Some devices implement only one of the two, which settles the question. Where both exist, FC06 is the simplest and its echo makes verification trivial, while standardizing on FC16 everywhere keeps driver behavior uniform and covers the multi-register case FC06 cannot. Check what the device supports and pick one pattern deliberately.
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.