Automation Glossary • Modbus Function Code 15 Write Multiple Coils

Modbus FC15 (Write Multiple Coils)

Merobix Engineering • • 4 min read

Function code 15 writes multiple coils in a single request, setting a whole bank of discrete outputs at once. It is the code to reach for when several coils must change together rather than one at a time. This reference explains how FC15 packs its coil values, how the device confirms the write, and why one FC15 beats a string of single-coil writes.

Back to Blog

Modbus Function Code 15 Write Multiple Coils in one line: Modbus function code 15 writes multiple coils in one request. It carries a starting coil address, a quantity, a byte count, and the coil states packed eight to a byte, least-significant bit first. On success the device replies with just the starting address and the quantity written, not the data. Using one FC15 sets a bank of outputs atomically instead of one round trip per coil.

How FC15 Packs and Writes a Coil Block

Function code 15 carries a starting coil address, a quantity of coils to write, a byte count, and then the coil states packed eight bits to a byte, with the first coil in the least significant bit of the first byte. Writing ten coils sends two data bytes, and the unused high bits of the final byte are ignored. This is the same packing used when reading coils, applied to a write. The device sets all the named coils and, on success, replies with only the starting address and the quantity written, since echoing all the data would be redundant.

Because FC15 sets the whole block in one operation, the coils change together rather than rippling one at a time across many requests. This atomic behavior is the main reason to prefer it when a group of outputs represents a coherent state that should never be seen half-applied. Its single-coil counterpart and the overall read-write grouping are covered in the Modbus function code overview.

FC15 Versus Repeated FC05 Writes

Setting eight coils with eight separate function code 05 requests takes eight round trips and leaves the outputs in a shifting intermediate state as each write lands. One FC15 request does the same work in a single exchange and applies all eight together, which is both faster and cleaner on a slow serial link where every round trip costs turnaround time. On a low-baud or radio path, collapsing many writes into one FC15 meaningfully reduces traffic, a concern discussed in the Modbus serial response delay reference.

As always, FC15 writes only the coil table. Discrete inputs are read-only and registers are sixteen-bit words, so neither is a valid target. If some of the coils in the requested range do not exist on the device, the whole request is rejected with an illegal data address exception rather than partially applied, so confirm the entire block is valid before writing. Which values are coils at all is settled by the Modbus register types reference.

Frequently Asked Questions

How does FC15 confirm a successful write?

The device replies with the starting coil address and the quantity of coils written, not the coil data itself. Matching that address and count to what was requested confirms the block was set. An exception response instead means the range was rejected, commonly because one or more coils in the block do not exist on the device.

Why use FC15 instead of several FC05 writes?

FC15 sets a whole bank of coils in one request, so they change together atomically and cost a single round trip. Repeated FC05 writes take one round trip each and leave the outputs in a shifting half-applied state between writes. On slow serial or radio links, one FC15 is markedly faster and avoids transient states.

How are the coil values packed in an FC15 request?

Eight coils to a byte, least-significant bit first, preceded by a byte count. The first coil in the range is the low bit of the first byte. If the quantity is not a multiple of eight, the unused high bits of the final byte are ignored by the device. This is the same packing scheme used when reading coils.

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.

Merobix is not affiliated with, endorsed by, or sponsored by these organizations; their names are used only to identify the standards and products discussed.

More in Industrial Protocols
Modbus Function Code 16 Write Multiple Registers  •  Modbus Function Code 01 Read Coils  •  Modbus Function Code 05 Write Single Coil  •  Modbus Function Code 06 Write Single Register  •  Modbus Illegal Function (Exception 01)  •  All Industrial Protocols →
Free SCADA operator training
Merobix University - 70 video lessons & 261 quiz questions, from first login to compliance reporting. No demo call required.
Start free →