Modbus Exception Codes — Diagnosing Slave Error Responses
Key Takeaway
What Modbus exception codes mean, how to identify them in frames, and how to diagnose and resolve each exception type.
Quick Answer
When a Modbus slave cannot process a request, it returns an exception response — the function code with bit 7 set (FC + 0x80) followed by an exception code. The code identifies the error type.
Exception Code Reference
| Code | Name | Meaning |
|---|---|---|
| 01 | Illegal Function | Function code not supported |
| 02 | Illegal Data Address | Register address out of range |
| 03 | Illegal Data Value | Value rejected by slave |
| 04 | Slave Device Failure | Internal slave error |
| 06 | Slave Device Busy | Retry later |
| 0A | Gateway Path Unavailable | Gateway can't route to slave |
| 0B | Gateway Target No Response | Target slave didn't respond |
Common Diagnoses
- Exception 02 — Most common. Usually a 0-based vs 1-based addressing error or register outside valid range.
- Exception 04 — Slave received the request but has an internal fault. Check device event log.
- Exceptions 0A/0B — Gateway issues. Check slave address mapping in the gateway and RS-485 wiring to the target device.
No Response vs Exception
Timeout (no response) = communication problem (wiring, address, device offline). Exception = device responded but reported an error. Different root causes, different troubleshooting approaches.
Frequently Asked Questions
Illegal Data Address — the register doesn't exist in the slave. Usually a 0-based vs 1-based addressing error or requesting registers beyond the valid range.
Timeout means no response (communication problem). Exception 04 means the slave responded but reported an internal failure.