hit counter script

Mitsubishi Electric FX5 User Manual page 231

Melsec iq-f series
Hide thumbs Also See for FX5:
Table of Contents

Advertisement

Two's complement is designated (Two's complement for 0000 01FDH: FFFF FE03H)
When Code Type is ASCII Decimal, the lower one word is extracted and converted from hexadecimal to decimal.
(hexadecimal: FE03H, decimal: 65027)
Code type
Data length (Values in ( ) indicate ASCII code.)
1 byte
ASCII hexadecimal
ASCII decimal
HEX
Calculation procedure for 16-bit CRC (for MODBUS)
This is an error check method to be used when data are transmitted/received with the RTU mode of the MODBUS protocol.
The data length of CRC is fixed to 2 bytes (16 bits), and the CRC is calculated every 1 byte (8 bits) from the start of the
calculating range according to the following procedure.
1.
Load a 16-bit register whose bits are all '1'.
2.
Exclusive OR (XOR) the first 1 byte (8 bits) of the calculating range with 8 bits in above 1.
3.
Shift the result of step 2 for one bit right.
4.
If the least significant bit in above 2 is '1', exclusive OR (XOR) the result of 3 with the generator polynomial (A001H). If
the least significant bit is '0', shift the result of step 3 one bit right (operation described in 3) without the exclusive OR
(XOR) operation.
5.
Repeat steps 3 and 4 for 8 times.
6.
Exclusive OR (XOR) the result of the above 5 with the next 1 byte (8 bits).
7.
Repeat step 3 through 6 until all bytes have been processed. The final result is CRC value.
8.
The CRC value is stored in a packet in the order of lower 8 bits  upper 8 bits.
The calculation example of 16-bit CRC (for MODBUS)
Ex.
Packet example
Station number
02H
Calculation method of 16-bit CRC (for MODBUS) for the above packet example
CRC error checking procedure
(Load a 16-bit register whose bits are all '1')
02H (Station number)
Exclusive OR (XOR)
Shift 1
Generator polynomial
Exclusive OR (XOR)
Shift 2
Generator polynomial
Exclusive OR (XOR)
Shift 3
Shift 4
Generator polynomial
Exclusive OR (XOR)
Shift 5
Shift 6
Generator polynomial
Exclusive OR (XOR)
Shift 7
Shift 8
Generator polynomial
Exclusive OR (XOR)
07H (Function code)
Exclusive OR (XOR)
2 byte
Function code
07H
16-bit register (MSB)
1111 1111
1111 1111
0111 1111
1010 0000
1101 1111
0110 1111
1010 0000
1100 1111
0110 0111
0011 0011
1010 0000
1001 0011
0100 1001
0010 0100
1010 0000
1000 0100
0100 0010
0010 0001
1010 0000
1000 0001
1000 0001
Appendix 2 Operation Image and Data Structure of Predefined Protocol
3 byte
16-bit CRC
41H
Flag
1111 1111
0000 0010
1111 1101
1111 1110
1
0000 0001
1111 1111
1111 1111
1
0000 0001
1111 1110
1111 1111
0
1111 1111
1
0000 0001
1111 1110
1111 1111
0
1111 1111
1
0000 0001
1111 1110
0111 1111
0
0011 1111
1
0000 0001
0011 1110
0000 0111
0011 1001
4 byte
EF30 (45H 46H 33H 30H)
0572 (30H 35H 37H 32H)
FFFF03FEH
12H
Calculating
procedure
1 to 2
3 to 4
5
6
APPENDIX
229
A

Advertisement

Table of Contents
loading

Table of Contents