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_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) reg_crc=(reg_crc>>1) ^ 0Xa001; /* LSB(b0)=1 */
else reg_crc=reg_crc >>1;
}
}
return reg_crc; // the value that sent back to the CRC register finally
}
Comments to this Manuals