Delta Electronics DVP10MC11T [295/375] Appendix a

Delta Electronics DVP10MC11T [295/375] Appendix a
Appendix A
DVP-MC operating manual A-11
Step 6: Repeat the action of step 2 and step 5 for the next byte in the command message till all bytes are
finished processing. The last content in CRC register is CRC check value. When CRC check value
in command message is transmitted, the high and low byte in calculated CRC check value must
exchange with each other, i.e. the low byte is transmitted first.
Example on calculation of CRC check value with C language
Unsigned char* data // Pointer of command message content
Unsigned char length // Length of command message content
unsigned int crc_chkunsigned char* data, unsigned char length
{
int j;
unsigned int reg_crc=0Xffff;
whilelength--
{
reg_crc ^= *data++;
for j=0;j<8;j++
{
If reg_crc & 0x01 reg_crc=reg_crc>>1 ^ 0Xa001; /* LSBb0=1 */
else reg_crc=reg_crc >>1;
}
}
return reg_crc; // the value that sent back to the CRC register finally
}

Содержание

Похожие устройства

Скачать