Function codes are written in decimal (FC 16) as well as in hex (0x10); both mean the same. Codes 65–72 and 100–110 are left to vendors for their own functions.
01 Read Coils
0x01 · Coils (0x)
Reads 1 to 2000 output bits (coils). The request carries the start address and quantity; the response carries a byte count and the bits packed 8 per byte, with the first address in the lowest bit.
Coils are relay outputs or switchable flags. Many meters and inverters have no coils at all and keep status bits in holding registers instead. If 01 returns exception 01, look for the register that carries the bit.
02 Read Discrete Inputs
0x02 · Discrete inputs (1x)
Reads 1 to 2000 read-only input bits (discrete inputs), packed 8 per byte like coils.
Typical for the digital inputs of I/O modules and PLCs. Meters and inverters rarely use it; they report states in registers.
03 Read Holding Registers
0x03 · Holding registers (4x)
Reads 1 to 125 consecutive 16-bit holding registers. The request carries the start address and quantity; the response carries a byte count and two bytes per register, high byte first.
By far the most used function. Most meters, inverters and drives publish everything as holding registers, even read-only measurements. Exception 02 usually means an address off by one or a read across a gap in the register map.
04 Read Input Registers
0x04 · Input registers (3x)
Reads 1 to 125 read-only 16-bit input registers. The frames look exactly like those of function 03.
Some devices keep measurements in input registers and settings in holding registers. If 03 returns exception 02 or only zeros, try 04 at the same address, and the other way round.
05 Write Single Coil
0x05 · Coils (0x)
Switches one coil. The value is FF 00 for ON and 00 00 for OFF; anything else is invalid. The response is an exact copy of the request.
Sending 00 01 for ON is a common mistake and ends with exception 03. Some devices use a coil for one-shot actions such as resetting energy counters.
06 Write Single Register
0x06 · Holding registers (4x)
Writes one 16-bit value to a holding register. The response is an exact copy of the request.
Not suitable for 32-bit values, because the two halves would be written at different times. Some devices accept 06 only for certain registers and require 16 for the rest.
07 Read Exception Status
0x07 · serial line only
Reads eight status bits whose meaning each device defines itself.
Rarely used today; check the manual to see whether the device supports it at all.
08 Diagnostics
0x08 · serial line only
Diagnostics selected by a subfunction. Subfunction 0000 sends the data straight back (loopback); others read or clear the bus counters.
Subfunction 0000 is a quick way to test the line without touching any register, if the device supports it.
11 Get Comm Event Counter
0x0B · serial line only
Returns a status word and a counter of successfully processed messages.
Reading the counter twice shows whether the device receives and processes your requests at all.
12 Get Comm Event Log
0x0C · serial line only
Returns a status word, event and message counters and the last 64 communication events.
Supported by few devices; mainly useful when chasing intermittent errors.
15 Write Multiple Coils
0x0F · Coils (0x)
Writes 1 to 1968 consecutive coils. The values are packed 8 per byte like in function 01; the response repeats the start address and quantity.
The byte count must match the quantity: 10 coils need 2 bytes. A mismatch ends with exception 03.
16 Write Multiple Registers
0x10 · Holding registers (4x)
Writes 1 to 123 consecutive holding registers. The request carries the start address, quantity, byte count and values; the response repeats the start address and quantity.
The right way to write 32-bit values such as floats, because both halves change at once. Some devices refuse 16 for a single register and want 06, others refuse 06.
17 Report Server ID
0x11 · serial line only
Returns a vendor-specific identification block and a run/stop indicator.
The content differs from vendor to vendor; function 43/14 is the structured replacement.
20 Read File Record
0x14
Reads file records: numbered groups of registers addressed by file and record number.
Used for logs or configuration areas in some devices; rare in practice.
21 Write File Record
0x15
Writes file records: numbered groups of registers addressed by file and record number.
Rare in practice; the device manual describes the file layout.
22 Mask Write Register
0x16 · Holding registers (4x)
Changes single bits of one holding register: result = (current AND and-mask) OR (or-mask AND NOT and-mask).
Sets one bit of a control word without reading it first. Many devices do not support it; then read with 03, change the bit and write back with 06.
23 Read/Write Multiple Registers
0x17 · Holding registers (4x)
Writes and reads registers in one transaction; the write is done first. Up to 121 registers are written and up to 125 read.
Supported mainly by PLCs. If a device answers exception 01, use 16 and 03 one after the other.
24 Read FIFO Queue
0x18
Reads up to 31 registers from a first-in-first-out queue, preceded by their count.
Rarely supported.
43 Encapsulated Interface Transport
0x2B
A container for sub-protocols selected by the MEI type. MEI type 0E, Read Device Identification, returns text objects such as vendor name, product code and firmware version.
Handy for finding out what sits on the bus without a manual. Support is optional, and many simple devices answer exception 01.