Modbus Exception Code 01 (Illegal Function): Causes & Fixes

When commissioning Modbus RTU or Modbus TCP industrial networks, receiving Modbus Exception Code 01 (Illegal Function) indicates that your physical connection, baud rates, and slave ID addressing are completely functional—yet the targeted slave device strictly refuses to execute the requested operation. Here is an in-depth engineering breakdown of what causes Exception 01, how it appears on the wire, and how to resolve it across PLCs, SCADA hosts, and edge gateways.

What is Modbus Exception Code 01?

According to the official Modbus Application Protocol Specification V1.1b3, Exception Code 01 (Illegal Function) is defined as follows:

"The function code received in the query is not an allowable action for the server (or slave). This may be because the function code is only applicable to certain kinds of devices, and is not implemented in the server selected. It could also indicate that the server is in the wrong state to process a request of this type."

In simpler terms: your master transmitted a function code that the slave's firmware does not recognize, does not support, or currently has locked out. Unlike Modbus Exception Code 02 (Illegal Data Address) where the function code is valid but the register offset is out of bounds, Exception 01 means the slave cannot even begin evaluating the register address because the command itself is disallowed.

How Exception Code 01 Appears on the Wire

When a slave receives an unsupported function code, it constructs an Exception Response Frame following standard Modbus protocol rules:

  1. Slave Address Byte: Echoes the targeted Unit ID / Slave Address (e.g., 0x01).
  2. Exception Function Code Byte: The original function code transmitted by the master, with its most significant bit (MSB, bit 7, 0x80) set to 1.
    • If Master sent 0x01 (Read Coils) → Slave returns 0x81
    • If Master sent 0x05 (Write Single Coil) → Slave returns 0x85
    • If Master sent 0x06 (Write Single Register) → Slave returns 0x86
    • If Master sent 0x10 (Write Multiple Registers, decimal 16) → Slave returns 0x90
  3. Exception Code Byte: The literal byte value 0x01, identifying Illegal Function.
  4. Error Check: Standard 16-bit CRC (for Modbus RTU) or MBAP length header (for Modbus TCP).
Example Wire Capture (Modbus RTU over RS-485):
Master Request: 01 05 00 00 FF 00 8C 3A (Write ON to Coil 0)
Slave Response: 01 85 01 83 60 (Slave 1, Exception 0x85, Code 0x01, CRC)
Interpretation: Slave 01 does not support discrete coils or Function Code 05.

Top 5 Root Causes of Exception Code 01 in Industrial Systems

1. Attempting Write Operations on Read-Only Instrumentation

In process plants and power distribution systems, many sensors—such as digital power meters, BTU thermal meters, ultrasonic flow transmitters, and thermocouple transducers—are manufactured with read-only firmware. These devices map all process variables to Input Registers (30001–39999, Function Code 04) or read-only Holding Registers (40001–49999, Function Code 03).

If your SCADA software (such as Ignition, Wonderware, or FactoryTalk) or PLC communications block attempts to write a configuration parameter, reset an accumulator, or clear a fault counter using Function Code 06 or Function Code 16, the device firmware immediately rejects the frame with Exception 01.

Fix: Consult the vendor's register map. If the parameter is designated as read-only, remove write tags in your host software. If the parameter is writable, check if a physical DIP switch, hardware jumper, or front-panel security PIN must be set to "Write Enable" mode.

2. Function Code 06 (Write Single) vs Function Code 16 (Write Multiple) Incompatibility

This is one of the most common surprises when upgrading SCADA software or PLC communication drivers. The Modbus standard specifies two distinct function codes for writing holding registers:

Many compact PLCs, smart actuators, VFD drives, and embedded microcontrollers only implement Function Code 06 to conserve flash memory. However, many modern SCADA engines default to using Function Code 16 for all write operations—even when writing a single 16-bit integer! When the slave receives FC 16 (0x10), it does not execute the write and returns Exception 01.

Fix: In your Modbus master driver configuration (in Kepware, Modbus Poll, Node-RED, or ModbusSimulator), locate the setting labeled "Write Single Registers using Function 06" or "Force FC 06 for Single Register Writes" and enable it.

3. Hexadecimal vs. Decimal Notation Mix-ups

Modbus function codes are conventionally expressed in decimal, but transmitted over the wire in hexadecimal bytes. When configuring custom Modbus master blocks in PLCs or test software:

Fix: Double-check the base (DEC vs HEX) of your driver configuration dialog. Ensure Write Multiple Registers transmits 0x10, not 0x16.

4. Mismatched Table Types: Coils vs Registers

Modbus organizes data into four distinct memory tables:

Table Type Data Size Access Standard Function Codes
Discrete Inputs (1x) 1 bit Read-Only FC 02 (0x02)
Coils (0x) 1 bit Read/Write FC 01 (0x01), FC 05 (0x05), FC 15 (0x0F)
Input Registers (3x) 16 bits Read-Only FC 04 (0x04)
Holding Registers (4x) 16 bits Read/Write FC 03 (0x03), FC 06 (0x06), FC 16 (0x10)

If your polling application issues Function Code 01 (Read Coils) to a device that has no discrete bit table and only exposes 16-bit analog registers, the device will respond with Exception 01. Always verify that your query function code matches the device's actual physical memory architecture.

5. Modbus Gateway / Protocol Converter Protocol Mismatch

When routing Modbus TCP queries through an Ethernet-to-Serial gateway (such as a Moxa MB3170 or Advantech ADAM-4572), the gateway repackages TCP frames into RTU frames. If the master sends a specialized or vendor-specific function code (e.g., FC 20 Read File Record, FC 43 Read Device Identification) that the gateway's internal firmware parser does not support in its translation table, the gateway itself may intercept the query and return Exception 01 without ever forwarding the packet to the downstream serial bus.

Fix: Update the gateway firmware to the latest version and configure the serial operating mode to "Transparent / Tunneling Mode" rather than "Smart Gateway / Modbus Concentrator Mode".

Step-by-Step Diagnostic Workflow for Exception Code 01

Follow this systematic 4-step troubleshooting procedure to isolate and eliminate Exception 01 errors:

  1. Capture Raw Frames: Connect an RS-485 USB adapter with a terminal monitor, or capture network traffic using Wireshark for Modbus TCP. Filter by modbus.func_code >= 128 to locate exception frames.
  2. Verify Function Code Byte: Inspect the byte directly following the Slave ID. Subtract 0x80 from the exception byte to determine which function code the master sent. (e.g., 0x86 - 0x80 = 0x06).
  3. Check Device Manual Function Code Table: Look up the supported function codes section in the vendor documentation. Verify whether the device explicitly lists that function code as supported.
  4. Test Alternative Function Codes: If FC 16 fails, test FC 06. If FC 04 fails, test FC 03. If write operations fail, check hardware write-protect switches on the instrument.

Simulating and Testing Exception 01 with ModbusSimulator

Before deploying new SCADA polling routines or PLC logic to live manufacturing plants, you can simulate exact exception conditions using ModbusSimulator on Windows:

Diagnose Modbus Errors in Minutes With ModbusSimulator

Simulate unlimited Modbus TCP and RTU devices, test custom function code configurations, and verify PLC/SCADA communication without physical hardware.

Download Free 30-Day Trial →

Summary Comparison: Exception Code 01 vs Other Common Exceptions

Exception Code Name Meaning Primary Fix
01 (0x01) Illegal Function Function code not implemented or disallowed by device Switch to supported FC (FC 06 vs 16, FC 03 vs 04) or disable write tags
02 (0x02) Illegal Data Address Register address is outside memory boundaries Adjust 0-based vs 1-based offset or reduce read quantity
03 (0x03) Illegal Data Value Data field value or block quantity exceeds allowable limit Check quantity limits (max 125 registers for FC 03) or write value ranges
04 (0x04) Slave Device Failure Unrecoverable hardware or memory fault inside the slave Power cycle instrument, check sensor wiring, or inspect device diagnostics

Related Engineering Resources