- -
HLP-C
+
Inverters
CRC register and save the result to CRC register
⑶
done 1 bit right shift with CRC register and fill zero to left
bit, then check low bit of CRC register.
⑷
if the low bit is zero, then do repeat setp3, else CRC register
do Exclusive OR with 0A001H.
⑸
done repeat step 3 and 4,until CRC register done right shift 8
times,then the byte is fully done.
⑹
done repeat step 2 to 5 for the next byte of data, until process
completely all data. The last data of CRC register is CRC value.
When send CRC value in command data, low bytes must change
the sequence with high bytes, i.e. low bytes will be sent first.
⑺
for example 1: Write 30.00Hz to inverter of 01
Command data
ADDR
FUNC
LEN
DATA
CRC
01H
02H
03H
00H 0BH B8H
7FH 0CH
Sent data
:
01H 02H 03H 00H 0BH B8H 7FH 0CH
⑻
for example 2:
The following is that get CRC value with C language. The
function has two parameters:
Unsigned char data ← the point of data buffer
Unsigned char lengh ← number of data buffer
This function will send back the CRC value with unsigned
integer format.
unsigned int crc_chk(unsigned char data,unsigned char
lengh)
{
int j;
unsigned int reg_crc=0xffff;
while (lengh--){
reg_crc^=*data=++;
for(j=0;j<8;j++={
if(reg_crc&0×01){/*LSB(b0)=1*/
reg_crc=(reg_crc>>1)^0xa001;
}else{
reg_crc=reg_crc>>1;