Mitsubishi Electric MELSEC iQ-R Series Reference Manual page 9

Modbus and modbus/tcp
Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

4.
If the least significant bit of the step 2 is '1', calculate the exclusive OR (XOR) from the result of step 3 and the generator
polynomial (A001H).
If the least significant bit is '0', do not calculate the exclusive OR (XOR), but shift it by 1 bit to the right.
5.
Repeat the step 3 and 4 until the bit is shifted up to 8 times.
6.
Calculate the exclusive OR (XOR) from the result of step 5 and the next 8 bits of the frame.
7.
Repeat the step 3 to 6.
8.
Repeat the above operations until the end of the data unit is reached. The final value is a calculated CRC value.
9.
The CRC value is stored in the frame in the order of lower 8 bits to upper 8 bits.
Ex.
The following is a calculation example in the case where function code 07H is sent to station No.2.
Error check range is as follows:
• Address field (1 byte): 02H
• Function code (1 byte): 07H
• Data (0 bytes)
CRC error checking procedure
1
Load the 16-bit register whose bits are all '1'.
2
Calculate the exclusive OR (XOR) from the first 8 bits of the
frame and the bits in the above.
3
Shift by 1 bit to the right.
4
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 1' and generator polynomial (A001H).
5
Shift by 1 bit to the right.
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 2' and generator polynomial (A001H).
Shift by 1 bit to the right.
Shift by 1 bit to the right.
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 4' and generator polynomial (A001H).
Shift by 1 bit to the right.
Shift by 1 bit to the right.
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 6' and generator polynomial (A001H).
Shift by 1 bit to the right.
Shift by 1 bit to the right.
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 8' and generator polynomial (A001H).
6
Calculate the exclusive OR (XOR) from the next 8 bits of the
frame and the bits in the above.
16-bit register (MSB)
16-bit register whose bits are all '1'.
Address field (02H)
Exclusive OR (XOR)
Shift 1
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 2
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 3
Shift 4
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 5
Shift 6
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 7
Shift 8
Generator polynomial (A001H)
Exclusive OR (XOR)
Function code (07H)
Exclusive OR (XOR)
1.1 MODBUS Protocol Frame Specifications
Flag
1111 1111
1111 1111
0000 0010
1111 1111
1111 1101
0111 1111
1111 1110
1
1010 0000
0000 0001
1101 1111
1111 1111
0110 1111
1111 1111
1
1010 0000
0000 0001
1100 1111
1111 1110
0110 0111
1111 1111
0
0011 0011
1111 1111
1
1010 0000
0000 0001
1001 0011
1111 1110
0100 1001
1111 1111
0
0010 0100
1111 1111
1
1010 0000
0000 0001
1000 0100
1111 1110
0100 0010
0111 1111
0
0010 0001
0011 1111
1
1010 0000
0000 0001
1000 0001
0011 1110
0000 0111
1000 0001
0011 1001
1 FRAME SPECIFICATIONS
1
*1
7

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents