Hi Team,
We are debugging the functions of DAC8760 and it is normal.Now because of the requirements of anti-jamming, we hope to add CRC check to SPI communication.
We used the following CRC8 algorithm, and the polynomial is x8+x2+x+1. However, It didn't work. We are looking for your support. Is there a DEMO C program with CRC verification for our reference? Thank you!
unsigned char crc_high_first(unsigned char *ptr, unsigned char len)
{
unsigned char i;
unsigned char crc=0x00;
while(len--)
{
crc ^= *ptr++;
for (i=8; i>0; --i)
{
if (crc & 0x80)
crc = (crc << 1) ^ 0x07;
else
crc = (crc << 1);
}
}
return (crc);
}