Mitsubishi Electric MELSEC iQ-R Series User Manual page 542

Serial communication module
Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

 Data Flow: Byte Swap
• "No Complement Calculation" is designated (1B0H in hexadecimal is 432 in decimal)
Code type
ASCII hexadecimal
ASCII decimal
HEX
*1 Values in '( )' indicate ASCII code.
• "One's complement" is designated (One's complement for 0000 01B0H is FFFF FE4FH)
When "Code type" is "ASCII decimal", the lower one word is extracted and converted from hexadecimal to decimal. (FE4FH
in hexadecimal is 65103 in decimal.)
Code type
ASCII hexadecimal
ASCII decimal
HEX
*1 Values in '( )' indicate ASCII code.
• "Two's complement" is designated (Two's complement for 0000 01B0H is FFFF FE50H)
When "Code type" is "ASCII decimal", the lower one word is extracted and converted from hexadecimal to decimal. (FE50H
in hexadecimal is 65104 in decimal.)
Code type
ASCII hexadecimal
ASCII decimal
HEX
*1 Values in '( )' indicate ASCII code.
■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 the 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.
APPENDICES APPENDIX
540
Appendix 5 Operation Image and Data Structure of Predefined Protocol
*1
Data length
1 byte
2 bytes
*1
Data length
1 byte
2 bytes
*1
Data length
1 byte
2 bytes
3 bytes
4 bytes
"100B" (31H 30H 30H 42H)
"4023" (34H 30H 32H 33H)
0000B001H
3 bytes
4 bytes
"EFF4" (45H 46H 46H 34H)
"1530" (31H 35H 33H 30H)
FFFF4FFEH
3 bytes
4 bytes
"EF05" (45H 46H 30H 35H)
"1540" (31H 35H 34H 30H)
FFFF50FEH

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents