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.).
True
Function 0x08 is the standardised diagnostic for serial Modbus. The main sub-functions are 0x00 Return Query Data (echoes the request -- loopback test), 0x01 Restart Communications Option, 0x0A Clear Counters and Diagnostic Register, 0x0B Return Bus Message Count (total frame counter), 0x0C Return Bus Communication Error Count, and 0x0D Return Bus Exception Error Count. It is very useful for auditing the quality of a serial bus in production. Note that it does NOT exist in Modbus TCP, where error handling is delegated to TCP itself.
Capture sub-functions 0x0B and 0x0C every hour into a trend log on critical serial buses: a slow drift in the error count is the earliest sign of a degrading cable or a noisy environment.
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
- 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.4. Function codes · Exception Responses
- 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)
- 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