2.8 Writing Configuration Bits
The procedure for writing Configuration bits is similar to the procedure for writing code memory.
To change the values of the Configuration bits once they have been programmed, the device must be erased, as described in Erasing Program Memory, and reprogrammed to the desired value.
Table 2-7 provides the ICSP programming details for writing the Configuration bits.
The code protection can be enabled by programming ‘0’ in the code protection
Configuration bits. In order to verify the data by reading the Configuration bits after
performing the write, the code protection bits should initially be programmed to
‘1’ to ensure that the verification can be performed properly.
After verification is finished, the code protection bits can be programmed to
‘0’ by using a word write to the appropriate Configuration
register.
| Command (Binary) | Data (Hex) | Description |
|---|---|---|
Step 1: Exit the Reset vector. | ||
|
|
|
Step 2: Initialize the TBLPAG register for writing to the latches. | ||
|
|
|
Step 3: Load W0:W1 with the next two Configuration Words to program. | ||
|
|
|
Step 4: Set the Write Pointer (W3) and load the write latches. | ||
|
|
|
Step 5: Set the NVMADRU/NVMADR register pair to point to the correct Configuration Word address. | ||
|
|
|
Step 6: Set the NVMCON register to program two instruction words. | ||
|
|
|
Step 7: Initiate the write cycle. | ||
|
|
|
|
Step 8: Generate clock pulses for the program operation to complete until the WR bit is cleared. | ||
— |
— |
Repeat until the WR bit is cleared. |
Step 9: Repeat Steps 3-8 until all Configuration registers are programmed. | ||
