ACD320 user manual
Appendix
independently conducts (XOR) with the preset value; if LSB is 0,the operation will not be
conducted.The entire process will be repeated eight times.After the completion of the last bit (the
eight bit), the next 8-bit byte will independently conduct (XOR) with the current value of the
register. The final value in the register is the CRC value after the execution of all bytes in the
frame.
The calculation method of CRC is the CRC principle in international standard.When
editing CRC algorithm, the user can refer to the CRC algorithm in related standard, to write a
CRC calculation program that really meets requirement.
Asimple function for CRC calculation is provided for reference (programmed in C
language):
unsigned int crc_cal_valueunsigned char*data_valueunsigned char data_length
{
int i
unsigned int crc_value=0xffff
whiledata_length--
{
crc_value^=*data_value++
fori=0i<8i++
{
ifcrc_value&0x0001crc_value=crc_value>>1^0xa001;
else crc_value=crc_value>>1
}
}
returncrc_value;
}
In ladder logic, CKSM calculates the CRCvalue accordingto the frame content in tale loop-up
method. This method features simple program, fast operation speed, but wider ROM space of
program. Please use this method prudently in occasions with certain program space requirement.
6.3.3 ASCII Mode Chesk(LRC Check
LRC Check Code is grouped of the value fromAddress to Data Content,lookup 6.2 check
code of communication message above:
0x02+0x06+0x00+0x08+0x13+0x88=0xAB, then get the two bytes =0x55 behind the radix
complement of 2.
6.4 Definition of Communication DataAddress
- 138-
    "