(N) Operation via communication and its settings
40
Message frame (protocol)
• Communication method
Basically, the master sends a query message (inquiry), and slaves return a response message (response). At normal
communication, the transaction identifier, protocol identifier, 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.
Message frames comprise the six message fields shown in the figures above.
• Details of protocol
The following table explains the six message fields.
Query messages from master
Transaction identifier
Transaction identifier
Protocol identifier
Protocol identifier
Length field
Length field
Unit identifier
Unit identifier
Function code
Function code
Eight-bit
Data bytes
Eight-bit
Data bytes
Response message from slave
Transaction identifier
Protocol identifier
Length field
Unit identifier
Function
Data
2
8 bits
2
8 bits
2
8 bits
8 bits
8 bits
n
8 bits
Message field
Description
Transaction identifier
The master adds the data for the purpose of transaction control.
The same data is returned in the response from the slave.
Protocol identifier
Fixed to 0. (When the slave receives data other than 0, it does not send the response message.)
0 is returned in the response from the slave.
Length field
The data length from the unit identifier to the data is stored in byte.
Unit identifier
Fixed to 255
Function code
1 to 255 can be set in single byte length (8 bits) for the function code. The master sets the function to be sent
to the slave as the request, and the slave performs the requested operation. "Function code list" summarizes
the supported function codes. An error response is generated when a function code other than "Function code
list" is set.
At a response from the slave, the function code set by the master is returned in the case of a normal response.
At an error response, H80 and the function code are returned.
Data
The format changes according the function code. (Refer to
.) The data, for example, includes the byte
count, number of bytes, and accessing content of holding registers.