Hi, i have to calculate the CRC of a string like:
“05 FF 65”
the CRC is “E5 CB”
how can i do in Dynamic C? On a rabbit 3700?
There is the function getcrc, how to use it?
Thanks
(I’m not so good in this language)
Alex
Hi, i have to calculate the CRC of a string like:
“05 FF 65”
the CRC is “E5 CB”
how can i do in Dynamic C? On a rabbit 3700?
There is the function getcrc, how to use it?
Thanks
(I’m not so good in this language)
Alex
Hi,
The problem with CRC’s is that there are many different type, and they may have different seed values, so your question would need to be more specific
int get_crc(char TXDATA[], int TXLEN){
auto int i;
auto int j;
unsigned int CRC;
CRC = 0xFFFF;
for (i = 0 ; i < TXLEN; i++){
CRC ^= TXDATA[i];
for (j= 0; j < 8 ; j++){
if (CRC & 0x0001)
CRC = (CRC >> 1) ^ 0x8408;
else
CRC = (CRC >> 1);
}
}
return CRC;
}