An app note from Microchip: Using a hardware or software CRC with enhanced core PIC16F1XXX in class B applications (PDF!)
Class B safety routines are increasingly used in microcontrollers to detect faults in safety-critical applications. The primary method for detecting faults in microcontroller program memory is by using a Cyclic Redundancy Check (CRC) as defined by the IEC 60730 standard.
A CRC can be used to prevent application faults due to corrupted program memory by performing a periodic check to determine if the check value has changed.
This application note will describe how to implement the Software CRC available as part of the Class B Safety Software Library and the hardware CRC used in selected microcontrollers (this document will focus on the PIC16F161X family).
Both methods discussed in this application note satisfy IEC 60730 spec H.22.214.171.124 to test Invariable Memory for all single-bit faults with 99.6% coverage.