Diagnosis (Function 8)
The diagnosis function provides a series of tests for checking the communication system between the master and the slave and for examining a variety of internal error states within the slave.
The function uses two bytes in the query to specify a sub-function code defining the test that is to be carried out. The slave returns the function code and the sub-function code in the response.
The diagnostic queries use a two-byte data field to send diagnostics data or control information to the slave.
Query
Byte Name |
Sample |
---|---|
Function code |
8 |
Sub-function high |
0 |
Sub-function low |
0 |
Data high |
2 |
Data low |
3 |
Response
Byte Name |
Sample |
---|---|
Function code |
8 |
Sub-function high |
0 |
Sub-function low |
0 |
Data high |
2 |
Data low |
3 |
Coupler reset (Sub-function 1)
The Bus Coupler is reset with sub-function 1, error counters are reset and the Bus Coupler performs a self-test. No telegrams are either received or sent while the Bus Coupler is being reset. The IP socket is closed.
Tip or pointer Before the Coupler restarts it sends a reply with sub-function 1, after which the IP socket is closed. |
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0001 |
0x0000 |
0x0000 |
Delete all counter contents (sub-function 10)
When this sub-function is called the controller clears all error counters.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x000A |
0x0000 |
Echo query data |
Read Coils (sub-function 32)
Indicates the number of Read Coils commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0020 |
0x0000 |
Counter value |
Read Coils Error (sub-function 33)
Indicates the number of Read Coils commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0021 |
0x0000 |
Counter value |
Read Discrete Inputs (sub-function 34)
Indicates the number of Read Discrete Inputs commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0022 |
0x0000 |
Counter value |
Read Discrete Inputs Error (sub-function 35)
Indicates the number of Read Discrete Inputs commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0023 |
0x0000 |
Counter value |
Read Holding Register (sub-function 36)
Indicates the number of Read Holding Register commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0024 |
0x0000 |
Counter value |
Read Holding Register Error (sub-function 37)
Indicates the number of Read Holding Register commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0025 |
0x0000 |
Counter value |
Read Input Register (sub-function 38)
Indicates the number of Read Input Register commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0026 |
0x0000 |
Counter value |
Read Input Register Error (sub-function 39)
Indicates the number of Input Holding Register commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0027 |
0x0000 |
Counter value |
Write Single Coil (sub-function 40)
Indicates the number of Write Single Coil commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0028 |
0x0000 |
Counter value |
Write Single Coil Error (sub-function 41)
Indicates the number of Write Single Coil commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0029 |
0x0000 |
Counter value |
Write Single Register (sub-function 42)
Indicates the number of Write Single Register commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x002A |
0x0000 |
Counter value |
Write Single Register Error (sub-function 43)
Indicates the number of Write Single Register commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x002B |
0x0000 |
Counter value |
Diagnostic Register (sub-function 44)
Indicates the number of Diagnostic Register commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x002C |
0x0000 |
Counter value |
Diagnostic Register Error (sub-function 45)
Indicates the number of Diagnostic Register commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x002D |
0x0000 |
Counter value |
Write Multiple Coils (sub-function 46)
Indicates the number of Write Multiple Coils commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x002E |
0x0000 |
Counter value |
Write Multiple Coils Error (sub-function 47)
Indicates the number of Write Multiple Coils commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x002F |
0x0000 |
Counter value |
Write Multiple Register (sub-function 48)
Indicates the number of Write Multiple Register commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0030 |
0x0000 |
Counter value |
Write Multiple Register Error (sub-function 49)
Indicates the number of Write Multiple Register commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0031 |
0x0000 |
Counter value |
R/W Multiple Register (sub-function 50)
Indicates the number of R/W Multiple Register commands.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0032 |
0x0000 |
Counter value |
R/W Multiple Register Error (sub-function 51)
Indicates the number of R/W Multiple Register commands with error.
Sub-function |
Data field (query) |
Data field (response) |
---|---|---|
0x0033 |
0x0000 |
Counter value |