When a Modbus slave cannot execute a request (invalid address, out-of-range value, etc.) it replies with an "Exception Response": the original function code with bit 7 set to 1, followed by an Exception Code explaining the reason.
True
An Exception Response is built as function_code OR 0x80, so a request 0x03 (Read Holding) returns 0x83 on error. It is followed by an Exception Code: 0x01 Illegal Function (function code not supported), 0x02 Illegal Data Address (address out of range), 0x03 Illegal Data Value (invalid value), 0x04 Slave Device Failure (internal error), 0x05 Acknowledge (received, processing is long), and 0x06 Slave Device Busy (try again later). These codes are critical for field diagnostics through Modbus logs.
Log the raw exception byte alongside the function code in any Modbus driver you write: "slave returned 0x83 / 0x02" is far more useful than "read failed".
Modbus bank in preparation
The full Modbus bank isn't available yet. Drop your email to get notified at launch and grab an early-bird discount.
Join the waitlist →See the 9 other Modbus practice questions
Related questions
- Which Modbus variant is today the most widely used for new installations in a modern IT/OT environment?2. Variants · RTU vs. TCP vs. ASCII
- Function 0x05 "Write Single Coil" writes a single binary output on a Modbus slave. The ON value is encoded as 0xFF00 and OFF as 0x0000; any other value is invalid.4. Function codes · Write Single Coil (0x05)
- Function 0x08 "Diagnostic" (serial Modbus RTU/ASCII only) is used to test communications and to read internal error counters of a slave through a set of sub-functions (Return Query Data, Restart Communications, Return Bus Message Count, etc.).4. Function codes · Diagnostic (0x08)
- When a Modbus TCP-to-RTU gateway bridges an RTU segment with several slaves, the Modbus TCP client uses the Unit ID in the MBAP header to target the specific RTU slave behind the gateway.5. Modbus TCP · Unit ID Gateway
- Modern energy meters (Schneider iEM, Socomec Diris, Janitza UMG, Siemens SENTRON) typically expose their measurements (kWh, kVARh, U, I, P, cos phi) over Modbus RTU or TCP, mapped onto standardised or vendor-specific registers.7. KNX integration · Energiezähler