Implementation of CRC16 using polynomial 0x8005 - (X^16+X^15+X^2+1)

Dependents:   HC05 S5info_APP4

cyclic redundancy check

A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data. Blocks of data entering these systems get a short check value attached, based on the remainder of a polynomial division of their contents; on retrieval the calculation is repeated, and corrective action can be taken against presumed data corruption if the check values do not match.

[source:http://en.wikipedia.org/wiki/Cyclic_redundancy_check]

This class implements a basic CRC16 (17Bits) using polynomial 0x8005 (X^16 + X^15 + X^2 +1).

How to use this library

basic use of CRC 16t

    char testdata[]= "123456789";    
    CRC16 *myCRC = new CRC16();
    unsigned short resultCRC = myCRC->calculateCRC16(testdata,9); //9 is the length of the character array //
    pc.printf("%x",resultCRC);
Download repository: zip gz

Files at revision 0:585ead300cab

Name Size Actions
[up]
CRC16.cpp 2741 Revisions Annotate
CRC16.h 265 Revisions Annotate