Datasheet

Table Of Contents
PIC18F2221/2321/4221/4321 FAMILY
DS39689F-page 274 © 2009 Microchip Technology Inc.
24.5 Program Verification and
Code Protection
The overall structure of the code protection on the
PIC18 Flash devices differs significantly from other
PIC
®
devices.
The user program memory is divided into three blocks.
One of these is a boot block of variable size. The
remainder of the memory is divided into two blocks on
binary boundaries.
Each of the three blocks has three code protection bits
associated with them. They are:
Code-Protect bit (CPn)
Write-Protect bit (WRTn)
External Block Table Read bit (EBTRn)
Figure 24-5 shows the program memory organization
for 4 and 8-Kbyte devices and the specific code
protection bit associated with each block. The actual
locations of the bits are summarized in Table 24-3.
FIGURE 24-5: CODE-PROTECTED PROGRAM MEMORY FOR PIC18F2221/2321/4221/4321
FAMILY DEVICES
MEMORY SIZE/DEVICE
Address
Range
Block Code Protection
Controlled By:
8Kbytes
(PIC18FX321)
4Kbytes
(PIC18FX221)
BBSIZ<1:0>
11/10 01 00 11/10/01 00
Boot Block
1K word
Boot Block
512 words
Boot Block
256 words
Boot Block
512 words
Boot Block
256 words
000000h
0001FFh
CPB, WRTB, EBTRB
Block 0
1.75K words
Block 0
0.75K words
000200h
0003FFh
Block 0
1.5K words
Block 0
0.5K words
000400h
0007FFh
CP0, WRT0, EBTR0
Block 0
1K word
Block 1
1K word
Block 1
1K word
000800h
000FFFh
Block 1
2K words
Block 1
2K words
Block 1
2K words
Unimplemented
Reads all ‘0’s
001000h
001FFFh
CP1, WRT1, EBTR1
Unimplemented
Reads all ‘0’s
002000h
1FFFFFh
(Unimplemented Memory
Space)