7. Interfaces and Communication
- 231 -
■
CRC Check
In Modbus-RTU mode, a message includes a CRC-based error-check field. The CRC field
checks content of entire message. The CRC field is two bytes, containing a 16-bit binary
value. The CRC field is calculated by transmitting device, and then added to message.
The receiving device recalculates a CRC value after receiving message, and compares
the calculated value with the CRC value in the received CRC field.
The CRC is first stored to 0xFFFF. Then a procedure is invoked to process the successive
8-bit byte in the message and the value in the register. Only the eight bits in each
character are used for the CRC. The start bit, stop bit and the parity bit do not apply to the
CRC.
During generation of the CRC, each eight-bit character is in exclusive-OR (XOR) with the
content in the register. Then the result is shifted in the direction of the least significant bit
(LSB), with a zero filled into the most significant bit (MSB) position. The LSB is extracted
and examined. If the LSB was a 1, the register then performs XOR with a preset value.
If the LSB was a 0, no XOR is performed. This process is repeated until eight shifts have
been performed. After the last (eighth) shift, the next eight-bit byte is in XOR with the
register's current value, and the process repeats for eight more shifts as described above.
The final value of the register, after all the bytes of the message have been applied, is the
CRC value.
The CRC is added to the message from the low-order byte followed by the high-order
byte. The CRC simple function is as follows:
unsigned int crc_chk_value
(
unsigned char *data_value,unsigned char length
)
{
unsigned int crc_value=0xFFFF;
int i;
while
(
length--
)
{
crc_value^=*dat+;
for
(
i=0;i<8;i++
)
{
if
(
crc_value&0x0001
)
{
crc_value=
(
crc_value>>1
)
^0xa001;
}
else
{
crc_value=crc_value>>1;
}
}
}
return
(
crc_value
)
;
}
7
Summary of Contents for GT600-4T132G
Page 1: ...GT600 AC Drive...
Page 5: ......
Page 86: ...5 Quick Setup 5 1 Get Familiar With Operating Panel 86 5 2 Setup Flowchart 87...
Page 87: ......
Page 100: ...5 Quick Setup 98 5...
Page 280: ...8 Peripherals and Options 278 8...
Page 306: ...12 303 11...
Page 362: ......