Appendix I H5RS485 Card & RS485Communication Protocol
128
I.3 Cyclical Redundancy Check
Cyclical Redundancy Check—CRC mode
:
CRC(Cyclical Redundancy Check) is in RTU
frame format, message contains an error-checking field that is based on a CRC method. The
CRC field checks the contents of the entire message. The CRC field is two bytes, containing a
16-bit binary value. The CRC value is calculated by the transmitting device, which appends the
CRC to the message. The receiving device recalculates a CRC during receipt of the message,
and compares the calculated value to the actual value it received in the CRC field. If the two
values are not equal, an error results. The CRC is started by 0xFFFF. Then a process begins of
applying successive 8-bit bytes of the message to the current contents of the register. Only the
eight bits of data in each character are used for generating the CRC. Start and stop bits, and the
parity bit, do not apply to the CRC.
During generation of the CRC, each eight-bit character is exclusive XOR with the register
contents. 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 extracted and examined. If the LSB
was 1, the register then exclusive XOR with a preset, fixed value. If the LSB was 0, no exclusive
XOR takes place. This process is repeated until 8 shifts have been performed. After the last (8)
shift, the next eight-bit byte is exclusive XOR with the register’s current value, and the process
repeats for 8 more shifts as described above. The final contents of the register, after all the
bytes of the message have been applied, is the CRC value.
When CRC appended to the message, the low byte is appended first, and then the high
byte.
CRC calculation program
:
unsigned int cal_crc16 (unsigned char *data, unsigned int length)
{
unsigned int i,crc_result=0xffff;
while(length--)
{
crc_result^=*data++;
for(i=0;i<8;i++)
{
if(crc_result&0x01)
crc_result=(crc_result>>1)^0xa001;
else
crc_result=crc_result>>1;
}
}
crc_result=((crc_result&0xff)<<8)|(crc_result>>8);
return(crc_result);
Содержание HV610C Series
Страница 1: ...HV610C Series Frequency Inverter User Manual HNC Electric Limited ...
Страница 25: ...Section II Installation Wiring 12 2 3 2 Typical wiring of HV610C in Crane applications ...
Страница 29: ...Section II Installation Wiring 16 Control board terminal layout ...
Страница 167: ......
Страница 175: ......