![SCOV SV800 Series Скачать руководство пользователя страница 235](http://html.mh-extra.com/html/scov/sv800-series/sv800-series_user-manual_1219567235.webp)
SV800/SV800A User Manual Appendix B: Communication
227
B.1.7 CRC16 function
CRC16 checkout value calculating function written by C language:
Uint16 CRC16(const Uint16 *data, Uint16 len)
{
Uint16 crcValue = 0xffff;
Uint16 i;
while (len--)
{
crcValue ^= *data++;
for (i = 0; i < 8; i++)
{
if (crcValue & 0x0001)
{
crcValue = (crcValue >> 1) ^ 0xa001;
}
else
{
crcValue = crcValue >> 1;
}
}
}
return (crcValue);
}