3.4.2 "Function Code" 8 (Diagnostics)
This "Function Code" 8 (Diagnostics) allows you to read diagnostics
data of the slave.
Modbus request Structure of the Modbus request:
Field Bytes Value Meaning
Function Code 1 8 = 08
h
Diagnostics
Sub-function Code 2 (various) Diagnostics function
Data 2 (various) Data (depending on diagnostics function)
Modbus response Structure of the positive Modbus response:
Field Bytes Value Meaning
Function Code 1 8 = 08
h
Diagnostics
Sub-function Code 2 (various) Diagnostics function
Data 2 (various) Diagnostics data
Structure of the negative Modbus response
Field Bytes Value Meaning
Function Code 1 08
h
+ 80
h
= 88
h
Diagnostics
Exception Code 1 01
h
... 04
h
See chapter
"3.3.2 Modbus response to a Modbus request"
Sub-function Code The following diagnostics functions are available:
Sub-function Code Diagnostics function
00 Return Query Data Return request as a response
01 Restart Communication Option Re-initialize the communication port
02 Return Diagnostic Register Return the error number in the case of synchronous errors
03 (reserved) –
04 Force Listen Only Mode Force "Listen Only" mode
05 ... 09 (reserved) –
10 Clear Counters and Diagnostic
Register
Clear all statistical counters
11 Return Bus Message Count Return number of detected "Bus Message"s
12 Return Bus Communication
Error Count
Return number of detected "Bus Communication Error"s
13 Return Bus Exception Error
Count
Return number of detected "Bus Exception Error"s
14 ... 15 (reserved) –
16 Return Slave NAK Count Return number of detected "Slave Not-Acknowledged"s
17 Return Slave Busy Count Return number of detected "Slave Busy"s
18 Return Bus Char Overrun
Count
Return number of detected "Bus Char Overrun"s
>18 (reserved) –
LXM32M
3 Basics
Modbus-TCP module 29
0198441113843, V1.01, 01.2012