Message frame (protocol)
• Communication method
Basically, the master sends a query message (inquiry), and slaves return a response message (response). At normal
communication, the device address and function code are copied as they are, and at erroneous communication (illegal
function code or data code), bit 7 (= H80) of the function code is turned ON, and the error code is set at data bytes.
Query message from Master
Message frames comprise the four message fields shown in the figures above.
A slave recognizes message data as one message when a 3.5 character long no-data time (T1: start/end) is added before
and after the data.
• Details of protocol
The following table explains the four message fields.
5.11 (N) Communication operation parameters
Response message from slave
"0 to 247" can be set in the single-byte (8-bit) length field. Set "0" when sending broadcast messages
(instructions to all addresses), and "1 to 247" to send messages to individual slaves.
The response from the slave also contains the address set by the master. The value set in Pr.117 PU
communication station number is the slave address.
"1 to 255" can be set as the function code in the single-byte (8-bit) length filed. The master sets the function to
be sent to the slave as the request, and the slave performs the requested operation. Refer to the function code
list for details of the supported function codes. An error response is generated when a function code other than
those in the function code list is set.
The normal response from the slave contains the function code set by the master. The error response contains
H80 and the function code.
The format changes according the function code. (Refer to
count, number of bytes, and accessing content of holding registers.
Errors in the received message frame are detected. Errors are detected in the CRC check, and the 2 bytes length
data is appended to the message. When the CRC is appended to the message, the lower bytes of the CRC are
appended first, followed by the upper bytes.
The CRC value is calculated by the sender that appends the CRC to the message. The receiver recalculates
the CRC while the message is being received, and compares the calculation result against the actual value that
was received in the error check field. If the two values do not match, the result is treated as an error.
n × 8 bits
185.) The data, for example, includes the byte