14.8 Program Memory Scan Configuration
The program memory scan module may be used in conjunction with the CRC module to perform a CRC calculation over a range of program memory addresses. To set up the scanner to work with the CRC the following steps need to performed:
- Set both the EN and SCANEN bits. If they get disabled, all internal states of the scanner and the CRC are reset. However, the CRC SFR registers are unaffected.
- Choose which memory access mode is to be used (see Scanning Modes) and set the MODE bits accordingly.
- Based on the memory access mode, set the INTM bits to the appropriate Interrupt mode (see Interrupt Interaction).
- Set the SCANLADR and SCANHADR registers with the respective beginning and ending locations in memory that are to be scanned.
- The GO bit must be set before setting the SCANGO bit. Setting the SCANGO bit starts the scan. Both the EN and GO bits must be enabled to use the scanner. When either of these bits are disabled, the scan aborts and the INVALID bit is set. The scanner will wait for the signal from the CRC that it is ready for the first Flash memory location, then begin loading data into the CRC. It will continue to do so until it either hits the configured end address or an address that is unimplemented on the device, at which point the SCANGO bit will clear, Scanner functions will cease, and the SCANIF interrupt will be triggered. Alternately, the SCANGO bit can be cleared in software to terminate the scan early if desired.