Modsak Manual v3.15 - 7.2. Message tracing

Download manual: PDF HTML

7.2. Message tracing

To enable message tracing, select the TracingTrace messages checkbox.

If message tracing is enabled, each Modbus message sent or received is logged as two lines.

The first line begins with the time that the message was sent or received. In monitor mode, the time is followed by 'M' for a message to or from the master, and 'S' for a message to or from the slave. This is followed by the character '<' for an incoming message or the character '>' for an outgoing message. The '<' or '>' is followed by the transaction identifier (only for TCP packets), slave identifier, PDU length (in bytes), function code, and then the first few bytes of the body of the message (in hex).

The second line of a message trace provides an interpretation of the main fields in the message. This line also begins with the time. After the time (and 'M' or 'S' in monitor mode) is the word "Request" for a request message, or "Response" for a normal response message. "Request" or "Response" is followed by the function code (expressed in words) and the main fields of the message (address, count, etc.).

Here is an example of an incoming and an outgoing message:

16:11:20.324: < transid 5 slave 1 pdulen 5 func 3: 00 c8 00 01
16:11:20.325:    Request: Read Holding Registers: address 200, count 1
16:11:20.326: > transid 5 slave 1 pdulen 4 func 3: 02 00 00
16:11:20.327:    Response: Read Holding Registers: byte count 2, data bytes 2

If the message is an error response, the second line will contain "Error response" followed by the error code (expressed in words), and possibly by further explanation of the error. For example:

16:23:43.186: < transid 10 slave 1 pdulen 5 func 3: 00 64 00 01
16:23:43.188:    Request: Read Holding Registers: address 100, count 1
16:23:43.192: > transid 10 slave 1 pdulen 2 func 131: 02
16:23:43.193:    Error response: Illegal data address - No Holding Register
    at model address 101 (message address 100)

If Modsak receives any data that is not correctly formatted as a Modbus message, it will also trace this data. The data is displayed in hex on a separate line, preceded by the time and the character '<'. This line is followed by a line with the word "Discarded" followed by the number of bytes discarded and an explanation of what is wrong with the format. For example:

15:18:13.554: < 00 01 00 00 00 06 01 03 00 64 02 01
15:18:13.555:    Discarded 12 bytes: CRC failed

Lines with "Response not sent" following the time may also be displayed in the log following a "Request" line. These indicate that Modsak did not send a response to a request from the master - the rest of the line says why the response was not sent. See the Responses setting for more information. For example:

16:19:18.776: < slave 0 pdulen 5 func 6: 00 c8 00 0c
16:19:18.777:    Request: Write Single Register: address 200, data bytes 2
16:19:18.778:    Response not sent: Request was broadcast

Troubleshooting help is available for the "Error response", "Response not sent" and "Discarded" lines. Click on the line in the log window (or move to it with the keyboard and press space) to display the help.