![HNC Electric HV590 Series User Manual Download Page 157](http://html.mh-extra.com/html/hnc-electric/hv590-series/hv590-series_user-manual_2142006157.webp)
152
Appendix I
H5RS485 Card & RS485Communication Protocol
Slave response
ADR
02H
CMD
06H
Data address high order
F0H
Data address low order
0AH
Data content high order
13H
Data content low order
88H
CRC CHK low order
CRC CHK values to be calculated
CRC CHK high order
I.4
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)
Summary of Contents for HV590 Series
Page 1: ...HV590 Series Frequency Inverter User Manual HNC Electric Limited ...
Page 189: ......
Page 192: ......