Ascii Mode - Mitsubishi Electric MELSEC iQ-R Series Reference Manual

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

Advertisement

CRC error checking procedure
7
Shift by 1 bit to the right.
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 1' and generator polynomial (A001H).
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.
Since the flag is '1', calculate the exclusive OR (XOR) from the
result in 'Shift 3' 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 5' and generator polynomial (A001H).
Shift by 1 bit to the right.
Shift by 1 bit to the right.
Shift by 1 bit to the right.
8
The final value is a calculated CRC value.
*1 The least significant bit from the previous exclusive OR (XOR)
Data is stored as follows:
Address field
02H

ASCII mode

In this mode, frames are received or sent in units of 2 characters (2 bytes) in ASCII codes.
The frame specifications are compliant with the MODBUS protocol specifications.
Start
Address field
:
2 characters
(3AH)
Error check in ASCII mode
The error check in the ASCII mode is conducted by LRC (Longitudinal Redundancy Check).
C24 calculates the LRC by the following steps.
Follow the same steps to calculate the LRC when conducting an error check on the target device.
1.
To calculate the LRC, convert the ASCII codes within the error check range into the RTU format (binary).
2.
Add the figures in units of contiguous 8 bits in the frame. (Excluding carries during addition.)
3.
Change the result of step 2 to a 2's complement. (Reverse the bits and add 01H.)
4.
Convert the result of step 3 to an ASCII code.
Ex.
The following are calculation examples in the case where function code 01H is sent to station No.2.
Error check range of the request message is as follows:
• Address field (1 byte): 02H
• Function code (1 byte): 01H
1 FRAME SPECIFICATIONS
8
1.1 MODBUS Protocol Frame Specifications
Function code
07H
Function code
2 characters
Error check calculation range
16-bit register (MSB)
Shift 1
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 2
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 3
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 4
Shift 5
Generator polynomial (A001H)
Exclusive OR (XOR)
Shift 6
Shift 7
Shift 8
CRC value
Error check
Lower 8 bits of the CRC value
41H
Data
Error check
n x 2 characters
2 characters
(n = 0 to 252)
0100 0000
1001 1100
1010 0000
0000 0001
1110 0000
1001 1101
0111 0000
0100 1110
1010 0000
0000 0001
1101 0000
0100 1111
0110 1000
0010 0111
1010 0000
0000 0001
1100 1000
0010 1110
0110 0100
0001 0011
0011 0010
0000 1001
1010 0000
0000 0001
1001 0010
0000 1000
0100 1001
0000 0100
0010 0100
1000 0010
0001 0010
0100 0001
12H
41H
Upper 8 bits of the CRC value
12H
END
CR + LF
(0DH) (0AH)
*1
Flag
1
1
1
0
1
0
0
0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents