10.07.2015 Views

SL092030 - NXP.com

SL092030 - NXP.com

SL092030 - NXP.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Philips Semiconductors Product Specification Revision 3.0 2004 January 30I•CODE UIDSL2 ICS1110.3 Example Routines for CRC 8 and CRC 16 Checksum CalculationThe following lines show C-code examples for the calculation of the CRC 8 and the CRC 16 checksum.10.3.1 CRC8_UID.C/* crc8_UID.c */#include #include #include #include #define PRESET 0xFD#define POLYNOMIAL 0x1D // x^8 + x^4 + x^3 + x^2 + 1 (MSB first)// CRC8 (MSB first)void crc8(unsigned char in, unsigned char *crc){int i;*crc = *crc ^ in;}for (i = 0; i < 8; i++){*crc = (*crc & 0x80)? (*crc

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!