Delta Electronics VFD-F Series manual Command message

Models: VFD-F Series

1 161
Download 161 pages 45.18 Kb
Page 88
Image 88
Manual background

Manual background VFD-F Series

Step 6: Repeat step 2 to 5 for the next 8-bit byte of the command message. Continue doing this until all bytes have been processed. The final contents of the CRC register are the CRC value. When transmitting the CRC value in the message, the upper and lower bytes of the CRC value must be swapped, i.e. the lower order byte will be transmitted first.

For example, read 2 words from the to address 2102H of AMD with address 01H. The CRC register content of last byte from ADR to number of data is F76FH. The command message is as following. 6FH will transmit before F7H.

Command message:

ADR

01H

CMD

03H

Data starting

02H

address

02H

Number of data

00H

(word)

02H

CRC CHK Low

6FH

CRC CHK High

F7H

The following is an example of CRC generation using C language. The function takes two arguments:

Unsigned char* data Å a pointer to the message buffer

Unsigned char length Å the quantity of bytes in the message buffer

The function returns the CRC values as a type of unsigned integer. unsigned int crc_chk(unsigned char* data, unsigned char length){

int j;

unsigned int reg_crc=0xFFFF; while(length--){

reg_crc ^= *data++; for(j=0;j<8;j++){

if(reg_crc & 0x01){ /* LSB(b0)=1 */ reg_crc=(reg_crc>>1) ^ 0xA001;

}else{ reg_crc=reg_crc >>1;

}

}

}

return reg_crc;

}

5

DELTA ELECTRONICS, INC. ALL RIGHTS RESERVED

5-55

Page 88
Image 88
Delta Electronics VFD-F Series manual Command message