6
1 FRAME SPECIFICATIONS
1.1 MODBUS Protocol Frame Specifications
1 FRAME SPECIFICATIONS
1.1 MODBUS Protocol Frame Specifications
This section describes the frame specifications of the MODBUS protocol.
The following frame modes are available.
• RTU mode
• ASCII mode
The frame mode of C24 must be consistent with that of the target device.
RTU mode
In this mode, frames are received or sent in binary codes.
The frame specifications are compliant with the MODBUS protocol specifications.
Error check in RTU mode
The error check in the RTU mode is conducted by CRC (Cyclic Redundancy Check).
C24 calculates the CRC by the following steps.
Follow the same steps to calculate the CRC when conducting an error check on the target device.
1. Load the 16-bit register whose bits are all '1'.
2. The CRC is calculated every 8 bits from the upper bit of the frame.
Calculate the exclusive OR (XOR) from the 8 bits of the frame and the bits of the step 1.
3. Shift the result of step 2 by 1 bit to the right.
Area name Description
Address field ■When request message is sent from the master to a slave
• 0: Sends a request message to all the slaves. (Broadcast)
• 1 to 247: Stores the target slave station number.
■When response message is sent from a slave to the master
The host station number is stored when sending a response message.
Protocol data unit Function code ■When request message is sent from the master to a slave
Specifies the content of the processing instructed from the master to a slave.
■When response message is sent from a slave to the master
A requested function code is stored in the case of normal completion.
The most significant bit turns ON in the case of error completion.
Data ■When request message is sent from the master to a slave
Stores the request content of the processing.
■When response message is sent from a slave to the master
Stores the execution result of the processing.
Error check The master adds a check code in a request message and transmits the request message.
The slave, which received the request message, recalculates the check code in the request message
and determines whether the message is correct or not.
The message is discarded if it has an error.
The error check method differs depending on the frame mode.
DataAddress field Function code Error check
Protocol data unit
Start
END
(Start)
DataAddress field Function code Error check Address field
3.5 character time
or more
1 byte 1 byte
0 to 252 bytes
2 bytes
3.5 character time
or more
1 byte
Error check calculation range