3-2. Modbus Protocol
8
3-2. Modbus Protocol
Modbus communication is based on master/slave method, that can communicate with some slaves. Master
sends a message to slaves, and slaves send back a response.
Message frame of Modbus-RTU mode
Address
Function
Data
Error Check
8bit(0 –128)
8bit
N*8bit(Depends on the function)
16bit(CRC-16)
Address
Setting address of slaves
Function
Setting function code you want to carry out
Error check (CRC-16)
CRC -16 is binary of 16 bits, and sending side calculates and adds the calculated value to the message.
Receiving side must confirm that the error check value is same as the calculated value. If it is not same,
the received message becomes error.
CRC-16 Calculation Method
・
It performs XOR of the register initialized by FFFF(Hex) and the byte data of the message.
・
The result value is shifted 1 bit to the direction of the last figure.(Shift 1 bit to right)
・
In case that the last figure is 1, performs XOR of register and A001(Hex).
・
This is repeated 8 times(for 8bit)
・
The value of this register becomes the CRC level when this calculation is performed for the byte data of the
message.