Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: XBee mbed NetServicesMin
culc_crc16.cpp
00001 #include "mbed.h" 00002 #include "types.h" 00003 #include "config.h" 00004 #include "culc_crc16.h" 00005 00006 unsigned int One_Byte_CRC16_Calc (uint16_t crc , uint8_t data) 00007 { 00008 // DBG("++++++++++++ CRC culc start initial CRC:%04X DATA:%04X\n",crc,data); 00009 for (int i = 0; i < 8; ++i) 00010 { 00011 if ((crc / 0x7fff) ^ (data & 0x01)) // Ex-OR input LSB first 00012 { 00013 crc = crc ^ 0x4002; // 0100 0000 0000 0010 << 1 00014 crc = crc << 1; 00015 crc ++; 00016 } 00017 else 00018 { 00019 // crc = crc *2; // left shift 00020 crc = crc << 1; 00021 } 00022 // TEMP = TEMP/2; // right shift 00023 data = data >> 1; 00024 } 00025 // DBG("************** CRC culc result CRC:%04X\n",crc); 00026 return crc; 00027 }
Generated on Wed Jul 13 2022 03:39:54 by
