i have gone through CCITT and TI's Document regarding msp430. Is it possible to calculate CRC for MSP430F5438A using any in built function? Or do i have to calculate CRC for each data taken.
Asked
Active
Viewed 1,457 times
1 Answers
0
A software implementation can be used in place of using the hardware peripheral on the MSP430F5438A. It can be implemented as follows:
unsigned short crc16(volatile unsigned char *sbuf,unsigned char len){
unsigned short crc=0xFFFF;
while(len){
crc=(unsigned char)(crc >> 8) | (crc << 8);
crc^=(unsigned char) *sbuf;
crc^=(unsigned char)(crc & 0xff) >> 4;
crc^=(crc << 8) << 4;
crc^=((crc & 0xff) << 4) << 1;
len--;
sbuf++;
}
return crc;
}//crc16()
Code courtesy of Jens-Michael Gross @ e2e.ti.com (http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/19030.aspx)

bblincoe
- 2,393
- 2
- 20
- 34