Diagnostics Modbus function code 08 provides a series of tests for checking the communication system between a client device and a server, or for checking various internal error conditions within a server. The function uses a two-byte sub-function code field in the query to define the type of test to be performed. The server echoes both the function code and sub-function code in a normal response. Some of the diagnostics cause data to be returned from the remote device in the data field of a normal response. Request: Name Length Value Function code 1 Byte 08h Sub-function 2 Bytes Data N x 2 Bytes Response: Name Length Value Function code 1 Byte 08h Sub-function 2 Bytes Data N x 2 Bytes Error: Name Length Value Error code 1 Byte 88h Exception code 1 Bytes 01 or 03 or 04 Clear Counters and Diagnostic Register (FC8.10) The objective of this request is to clear all counters and the diagnostic register. Counters are also cleared upon power-up. Sub-function Data Field Request Response 00h 0Ah 00h 00h Echo Request Data Example Request Response Return Bus Message Count (FC8.11) The response data field returns the quantity of messages that the remote device has detected on the communications system since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Bh 00h 00h Total Message Count Return Bus Communication Error Count (FC8.12) The response data field returns the quantity of CRC errors encountered by the remote device since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Ch 00h 00h CRC Error Count Example Request Response Return Bus Exception Error Count (FC8.13) The response data field returns the quantity of Modbus exception responses returned by the remote device since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Dh 00h 00h Exception Error Count Example Request Response Return Server Message Count (FC8.14) The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Eh 00h 00h Server Message Count Example Request Response Return Server No Response Count (FC8.15) The response data field returns the quantity of messages addressed to the remote device for which it has returned no response (neither a normal response nor an exception response), since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Fh 00h 00h No Response Count Example Request Response Return Server NAK Count (FC8.16) The response data field returns the quantity of messages addressed to the remote device for which it returned a Negative Acknowledge (NAK) exception response, since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 10h 00h 00h Server NAK Count Example Request Response Return Server Busy Count (FC8.17) The response data field returns the quantity of messages addressed to the remote device for which it returned a Server Device Busy exception response, since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 11h 00h 00h Server NAK Count Example Request Response Return Bus Character Overrun Count (FC8.18) The response data field returns the quantity of messages addressed to the remote device that it could not handle due to a character overrun condition, since its last restart, clear counters operation, or power-up. A character overrun is caused by data characters arriving at the port faster than they can be stored, or by the loss of a character due to a hardware malfunction. Sub-function Data Field Request Response 00h 12 00h 00h Server Character Overrun Count Example Request Response
Diagnostics Modbus function code 08 provides a series of tests for checking the communication system between a client device and a server, or for checking various internal error conditions within a server. The function uses a two-byte sub-function code field in the query to define the type of test to be performed. The server echoes both the function code and sub-function code in a normal response. Some of the diagnostics cause data to be returned from the remote device in the data field of a normal response. Request: Name Length Value Function code 1 Byte 08h Sub-function 2 Bytes Data N x 2 Bytes Response: Name Length Value Function code 1 Byte 08h Sub-function 2 Bytes Data N x 2 Bytes Error: Name Length Value Error code 1 Byte 88h Exception code 1 Bytes 01 or 03 or 04 Clear Counters and Diagnostic Register (FC8.10) The objective of this request is to clear all counters and the diagnostic register. Counters are also cleared upon power-up. Sub-function Data Field Request Response 00h 0Ah 00h 00h Echo Request Data Example Request Response Return Bus Message Count (FC8.11) The response data field returns the quantity of messages that the remote device has detected on the communications system since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Bh 00h 00h Total Message Count Return Bus Communication Error Count (FC8.12) The response data field returns the quantity of CRC errors encountered by the remote device since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Ch 00h 00h CRC Error Count Example Request Response Return Bus Exception Error Count (FC8.13) The response data field returns the quantity of Modbus exception responses returned by the remote device since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Dh 00h 00h Exception Error Count Example Request Response Return Server Message Count (FC8.14) The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Eh 00h 00h Server Message Count Example Request Response Return Server No Response Count (FC8.15) The response data field returns the quantity of messages addressed to the remote device for which it has returned no response (neither a normal response nor an exception response), since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Fh 00h 00h No Response Count Example Request Response Return Server NAK Count (FC8.16) The response data field returns the quantity of messages addressed to the remote device for which it returned a Negative Acknowledge (NAK) exception response, since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 10h 00h 00h Server NAK Count Example Request Response Return Server Busy Count (FC8.17) The response data field returns the quantity of messages addressed to the remote device for which it returned a Server Device Busy exception response, since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 11h 00h 00h Server NAK Count Example Request Response Return Bus Character Overrun Count (FC8.18) The response data field returns the quantity of messages addressed to the remote device that it could not handle due to a character overrun condition, since its last restart, clear counters operation, or power-up. A character overrun is caused by data characters arriving at the port faster than they can be stored, or by the loss of a character due to a hardware malfunction. Sub-function Data Field Request Response 00h 12 00h 00h Server Character Overrun Count Example Request Response
Clear Counters and Diagnostic Register (FC8.10) The objective of this request is to clear all counters and the diagnostic register. Counters are also cleared upon power-up. Sub-function Data Field Request Response 00h 0Ah 00h 00h Echo Request Data Example Request Response
Return Bus Message Count (FC8.11) The response data field returns the quantity of messages that the remote device has detected on the communications system since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Bh 00h 00h Total Message Count
Return Bus Communication Error Count (FC8.12) The response data field returns the quantity of CRC errors encountered by the remote device since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Ch 00h 00h CRC Error Count Example Request Response
Return Bus Exception Error Count (FC8.13) The response data field returns the quantity of Modbus exception responses returned by the remote device since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Dh 00h 00h Exception Error Count Example Request Response
Return Server Message Count (FC8.14) The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Eh 00h 00h Server Message Count Example Request Response
Return Server No Response Count (FC8.15) The response data field returns the quantity of messages addressed to the remote device for which it has returned no response (neither a normal response nor an exception response), since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 0Fh 00h 00h No Response Count Example Request Response
Return Server NAK Count (FC8.16) The response data field returns the quantity of messages addressed to the remote device for which it returned a Negative Acknowledge (NAK) exception response, since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 10h 00h 00h Server NAK Count Example Request Response
Return Server Busy Count (FC8.17) The response data field returns the quantity of messages addressed to the remote device for which it returned a Server Device Busy exception response, since its last restart, clear counters operation, or power-up. Sub-function Data Field Request Response 00h 11h 00h 00h Server NAK Count Example Request Response
Return Bus Character Overrun Count (FC8.18) The response data field returns the quantity of messages addressed to the remote device that it could not handle due to a character overrun condition, since its last restart, clear counters operation, or power-up. A character overrun is caused by data characters arriving at the port faster than they can be stored, or by the loss of a character due to a hardware malfunction. Sub-function Data Field Request Response 00h 12 00h 00h Server Character Overrun Count Example Request Response