8. Modbus protocol
8. 6. Diagnostics (8)
Request and response:
Slave no. |
| 08 |
|
|
|
|
| Data |
|
| CRC16 |
|
|
|
|
| |||||||||||
|
|
|
|
| Hi |
|
|
| Lo |
| Hi |
|
| Lo |
| Hi |
|
|
| Lo |
|
|
|
|
| ||
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 byte |
| 1 byte |
| 2 bytes |
|
|
|
| 2 bytes |
|
| 2 bytes |
|
|
| ||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sub | Function |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Request |
|
| Response | |||
code |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| data |
|
| data | ||
00 | Echo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| XX YY |
|
| XX YY | |||
| This function asks the slave to return the request sent by the master. The size |
|
|
|
|
|
|
|
|
| |||||||||||||||||
| of the data is limited to 2 bytes. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||
01 | Reinitialize channel |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16#00 00 |
| 16#00 00 | |||||||||
| This function is used to reinitialize slave communication and, in particular, to |
|
|
| or |
|
| or | |||||||||||||||||||
| make it exit listen only mode (LOM). |
|
|
|
|
|
|
|
|
|
|
|
|
| 16#FF 00 |
|
| 16#FF 00 | |||||||||
03 | Change ASCII delimiter |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| XX 00 |
|
| XX 00 | |||||
| In ASCII mode, messages are delimited by the line feed character |
|
|
|
|
| XX = new delimiter |
|
| ||||||||||||||||||
| (LF = H'0A). This function is used to change this character. |
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
04 | Change to LOM mode |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 00 00 |
| 00 00 | |||||||||
| This function is used to force a slave to listen only mode (LOM). In this mode, |
|
|
|
|
|
|
|
|
| |||||||||||||||||
| the slave does not handle messages which are addressed to it, nor does it send |
|
|
|
|
|
|
|
|
| |||||||||||||||||
| any responses, except when the channel is reinitialized. |
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
0A | Counter reset |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 00 00 |
| 00 00 | |||||||||
| This function resets all the counters responsible for monitoring slave |
|
|
|
|
|
|
|
|
| |||||||||||||||||
| exchanges. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||
0B | Read the number of correct messages on the line without checksum error | 00 00 |
|
| Value of | ||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| counter |
0C | Read the number of incorrect messages on the line with checksum error | 00 00 |
|
| Value of | ||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| counter |
0D | Read the number of exception responses sent by the slave |
|
| 00 00 |
|
| Value of | ||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| counter |
0E | Read the number of messages addressed to the slave excluding |
|
| 00 00 |
|
| Value of | ||||||||||||||||||||
| broadcast messages regardless of type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| counter | ||||||||
0F | Read the number of broadcast messages on the line regardless of type | 00 00 |
|
| Value of | ||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| counter |
10 | Read the number of NAK exception responses |
|
|
|
|
|
| 00 00 |
| 00 00 | |||||||||||||||||
| The value read is always 0. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||
11 | Read the number of slave not ready responses |
|
|
|
|
|
| 00 00 |
| 00 00 | |||||||||||||||||
| The value read is always 0. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||
12 | Read the number of messages received with character overrun |
|
| 00 00 |
|
| Value of | ||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| counter |
The counters are unsigned words. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
Example: Values 16#31 and 16#32 echoed by slave 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||||||||
Request and response: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||||||
Slave no. |
| Code |
| Subcode |
|
|
| Value of |
| Value of |
|
|
| CRC |
| CRC |
| ||||||||||
|
|
|
|
| Hi |
|
| Lo |
| 1st byte |
| 2nd byte |
|
|
| Lo |
| Hi |
| ||||||||
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||
04 |
|
| 08 |
| 00 |
|
|
|
| 00 |
|
| 31 |
| 32 |
| 74 |
|
| 1B |
|
29