EasyManua.ls Logo

Ublox ODIN-W2 Series - Page 40

Ublox ODIN-W2 Series
43 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ODIN-W2 series - System integration manual
UBX-14040040 - R20 Appendix Page 40 of 43
C1-Public
CRC calculation
/* byte = data buffer in the xmodem block */
/* count = number of data bytes */
/* offset = where to start the calculation */
private ushort xmodemCalcrc(byte[] buffer, int offset, int count)
{
ushort crc, i;
int j;
crc = 0;
for (j = offset; j < count + offset; j++) {
crc = (ushort)(crc ^ (buffer[j] << 8));
for (i = 0; i < 8; i++) {
if ((crc & 0x8000) > 0) {
crc = (ushort)((crc << 1) ^ 0x1021);
} else {
crc = (ushort)(crc << 1);
}
}
}
return (ushort)(crc & 0xFFFF);
}

Table of Contents

Other manuals for Ublox ODIN-W2 Series

Related product manuals