English
Language : 

C8051F99X_10 Datasheet, PDF (172/322 Pages) Silicon Laboratories – Ultra Low Power, 8-2 kB Flash, Capacitive Sensing MCU
C8051F99x-C8051F98x
16.2. Preparing for a CRC Calculation
To prepare CRC0 for a CRC calculation, software should set the initial value of the result. The polynomial
used for the CRC computation is 0x1021. The CRC0 result may be initialized to one of two values: 0x0000
or 0xFFFF. The following steps can be used to initialize CRC0.
1. Select the initial result value (Set CRC0VAL to 0 for 0x0000 or 1 for 0xFFFF).
2. Set the result to its initial value (Write 1 to CRC0INIT).
16.3. Performing a CRC Calculation
Once CRC0 is initialized, the input data stream is sequentially written to CRC0IN, one byte at a time. The
CRC0 result is automatically updated after each byte is written. The CRC engine may also be configured to
automatically perform a CRC on one or more 256 byte blocks. The following steps can be used to automat-
ically perform a CRC on Flash memory.
1. Prepare CRC0 for a CRC calculation as shown above.
2. Write the index of the starting page to CRC0AUTO.
3. Set the AUTOEN bit in CRC0AUTO.
4. Write the number of 256 byte blocks to perform in the CRC calculation to CRC0CNT.
5. Write any value to CRC0CN (or OR its contents with 0x00) to initiate the CRC calculation. The CPU will
not execute code any additional code until the CRC operation completes. See the note in SFR
Definition 16.1. CRC0CN: CRC0 Control for more information on how to properly initiate a CRC
calculation.
6. Clear the AUTOEN bit in CRC0AUTO.
7. Read the CRC result using the procedure below.
16.4. Accessing the CRC0 Result
The internal CRC0 result is 16 bits. The CRC0PNT bits select the byte that is targeted by read and write
operations on CRC0DAT and increment after each read or write. The calculation result will remain in the
internal CR0 result register until it is set, overwritten, or additional data is written to CRC0IN.
172
Rev. 1.0