Datasheet

PIC24FJXXXGA1/GB1
DS39907A-page 20 © 2007 Microchip Technology Inc.
3.7 Writing Configuration Words
Device configuration for PIC24FJXXXGA1/GB1 devices
is stored in Flash Configuration Words at the end of the
user space program memory, and in multiple register
Configuration Words located in the test space. These
registers reflect values read at any Reset from program
memory locations. The values for the Configuration
Words for the default device configurations are listed in
Table 3-6.
The values can be changed only by programming the
content of the corresponding Flash Configuration Word
and resetting the device. The Reset forces an automatic
reload of the Flash stored configuration values by
sequencing through the dedicated Flash Configuration
Words and transferring the data into the Configuration
registers.
For the PIC24FJXXXGA1/GB1 families, certain Config-
uration bits have default states that must always be
maintained to ensure device functionality, regardless of
the settings of other Configuration bits. These bits and
their values are listed in Table 3-7.
To change the values of the Flash Configuration Word
once it has been programmed, the device must be Chip
Erased, as described in Section 3.5 “Erasing Program
Memory”, and reprogrammed to the desired value. It is
not possible to program a ‘0’ to ‘1’, but they may be
programmed from a ‘1’ to ‘0’ to enable code protection.
TABLE 3-6: DEFAULT CONFIGURATION
REGISTER VALUES
TABLE 3-7: RESERVED CONFIGURATION
BIT LOCATIONS
Table 3-8 shows the ICSP programming details for pro-
gramming the Configuration Word locations, including
the serial pattern with the ICSP command code which
must be transmitted, Least Significant bit first, using the
PGCx and PGDx pins (see Figure 3-2).
In Step 1, the Reset vector is exited. In Step 2, the
NVMCON register is initialized for programming of
code memory. In Step 3, the 24-bit starting destination
address for programming is loaded into the TBLPAG
register and W7 register.
The TBLPAG register must be loaded with the
following:
64 Kbyte devices: 00h
128, 192 and 256 Kbyte devices: 01h
To verify the data by reading the Configuration Words
after performing the write in order, the code protection
bits initially should be programmed to a ‘1’ to ensure
that the verification can be performed properly. After
verification is finished, the code protection bit can be
programmed to a ‘0’ by using a word write to the
appropriate Configuration Word.
Address Name Default Value
Last Word CW1 7FFFh
Last Word – 2 CW2 F7FFh
Last Word – 4 CW3 FFFFh
Bit Location Value
CW1<15> 0
CW1<10> 1
CW2<11> 0
CW2<2>
(1)
1
Note 1: This bit is implemented as I2C2SEL on
PIC24FJXXXGA110 devices, and should
be programmed as required.