A
ALuPin
Hi,
I have found a piece of C code for checksum calculation
CRC16 ccitt.
Is that right?
How can I initialize crc?
#include <stdio.h>
int crc_1021(int data)
{
int x;
x = ((crc>>8) ^ data) & 0xff;
x ^= x>>4;
crc = (crc << 8) ^ (x << 12) ^ (x <<5) ^ x;
crc &= 0xffff;
return(crc);
}
int main()
{
int crc
printf("The CRC16-X25_ccitt of %d is %d. \n", crc, crc_1021(crc));
return 0;
}
I have found a piece of C code for checksum calculation
CRC16 ccitt.
Is that right?
How can I initialize crc?
#include <stdio.h>
int crc_1021(int data)
{
int x;
x = ((crc>>8) ^ data) & 0xff;
x ^= x>>4;
crc = (crc << 8) ^ (x << 12) ^ (x <<5) ^ x;
crc &= 0xffff;
return(crc);
}
int main()
{
int crc
printf("The CRC16-X25_ccitt of %d is %d. \n", crc, crc_1021(crc));
return 0;
}