Professional Documents
Culture Documents
PIC18FXX80 Programing Specification
PIC18FXX80 Programing Specification
TQFP
RE7/CCP2(1)
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7
RE5/P1C
RE6/P1B
RE2/CS
RE3
RE4
VDD
VSS
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
RE1/WR 1 48 RB0/INT0
RE0/RD 2 47 RB1/INT1
RG0/CANTX1 3 46 RB2/INT2
RG1/CANTX2 4 45 RB3/INT3
RG2/CANRX 5 44 RB4/KBI0
RG3 6 43 RB5/KBI1/PGM
RG5/MCLR/VPP 7 42 RB6/KBI2/PGC
RG4/P1D PIC18F6X8X VSS
8 41
VSS 9 40 OSC2/CLKO/RA6
VDD 10 39 OSC1/CLKI
RF7/SS 11 38 VDD
RF6/AN11/C1IN- 12 37 RB7/KBI3/PGD
RF5/AN10/C1IN+/CVREF 13 36 RC5/SDO
RF4/AN9/C2IN- 14 35 RC4/SDI/SDA
RF3/AN8/C2IN+ 15 34 RC3/SCK/SCL
RF2/AN7/C1OUT 16 33 RC2/CCP1/P1A
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
RF1/AN6/C2OUT
RF0/AN5
RC7/RX/DT
RA2/AN2/VREF-
RC1/T1OSI/CCP2(1)
RA3/AN3/VREF+
RC0/T1OSO/T13CKI
RA5/AN4/LVDIN
RC6/TX/CK
AVDD
RA1/AN1
RA0/AN0
VDD
RA4/T0CKI
AVSS
VSS
PLCC
RE7/CCP2(1)
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7
RE5/P1C
RE6/P1B
RE2/CS
RE3
RE4
VDD
N/C
VSS
9 8 7 6 5 4 3 2 1 68 67 66 65 64 63 62 61
RE1/WR 10 60 RB0/INT0
RE0/RD 11 59 RB1/INT1
Top View
RG0/CANTX1 12 58 RB2/INT2
RG1/CANTX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4/P1D 10 PIC18F8X8X 51 VSS
VSS 11 50 OSC2/CLKO/RA6
VDD 12 49 OSC1/CLKI
RF7/SS 13 48 VDD
RF6/AN11/C1IN- 14 47 RB7/KBI3/PGD
RF5/AN10/C1IN+/CVREF 15 46 RC5/SDO
RF4/AN9/C2IN- 16 45 RC4/SDI/SDA
RF3/AN8/C2IN+ 17 44 RC3/SCK/SCL
RF2/AN7/C1OUT 18 43 RC2/CCP1/P1A
RH7/AN15/P1B 19 42 RJ7/UB
RH6/AN14/P1C 20 41 RJ6/LB
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
RF1/AN6/C2OUT
RF0/AN5
RJ5/CE
RA2/AN2/VREF-
RJ4/BA0
RA3/AN3/VREF+
RC0/T1OSO/T13CKI
RA5/AN4/LVDIN
RC6/TX/CK
RC7/RX/DT
RC1/T1OSI/CCP2(2)
RH5/AN13
RH4/AN12
AVDD
RA1/AN1
RA0/AN0
VDD
RA4/T0CKI
AVSS
VSS
FIGURE 2-4: MEMORY MAP AND THE CODE MEMORY SPACE FOR PIC18FXX80/XX85 DEVICES
48 Kbytes 64 Kbytes
000000h 000000h
Code Memory Boot Block Boot Block 0007FFh
00FFFFh Panel 1 Panel 1
Block 1 Block 1 001FFFh
Panel 2 Panel 2
003FFFh
Panel 3 Panel 3
Block 2 Block 2 005FFFh
Unimplemented Panel 4 Panel 4
Read as ‘0’ 007FFFh
Panel 5 Panel 5
Block 3 Block 3 009FFFh
Panel 6 Panel 6
00BFFFh
Unimplemented Panel 7
Block 4 00DFFFh
Read as ‘0’s Panel 8
1FFFFFh 00FFFFh
Configuration
and ID
Space Unimplemented Unimplemented
Read as ‘0’s Read as ‘0’s
3FFFFFh 01FFFFh
CONFIG1L 300000h
CONFIG1H 300001h
CONFIG2L 300002h
CONFIG2H 300003h
1FFFFFh CONFIG3L 300004h
CONFIG3H 300005h
Configuration CONFIG4L 300006h
and ID CONFIG4H 300007h
Space CONFIG5L 300008h
CONFIG5H 300009h
CONFIG6L 30000Ah
2FFFFFh CONFIG6H 30000Bh
CONFIG7L 30000Ch
CONFIG7H 30000Dh
3FFFFFh
PGD
PGD
PGC
PGC
PGD = Input
PGD = Input
P2 P2A
P2B
1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4
PGC
P5 P5A
P4
P3
PGD 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 n n n n
0 4 C 3
4-Bit Command 16-Bit Data Payload Fetch Next 4-Bit Command
PGD = Input
PGD 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 n n
4-Bit Command 16-Bit 4-Bit Command 16-Bit 4-Bit Command Erase Time 16-Bit
Data Payload Data Payload Data Payload
PGD = Input
Step 5: Repeat step 4, with Address Pointer incremented by 64 until all panels are erased.
Start
Addr = 0
Configure
Device for
Multi-Panel Erase
Addr = Addr + 64
Delay P9 + P10
Time for Erase
to Occur
All
No Panels
Done?
Yes
Done
3.2 Code Memory Programming The programming duration is externally timed and is
controlled by PGC. After a “Start Programming” com-
Programming code memory is accomplished by first mand is issued (4-bit command, ‘1111’), a NOP is
loading data into the appropriate write buffers and then issued, where the 4th PGC is held high for the duration
initiating a programming sequence. Each panel in the of the programming time, P9.
code memory space (see Figure 2-4) has an 8-byte
deep write buffer that must be loaded prior to initiating After PGC is brought low, the programming sequence
a write sequence. The actual memory write sequence is terminated. PGC must be held low for the time spec-
takes the contents of these buffers and programs the ified by parameter P10 to allow high-voltage discharge
associated EEPROM code memory. of the memory array.
Typically, all of the program buffers are written in paral- The code sequence to program a PIC18FXX80/XX85
lel (Multi-Panel Write mode). For example, in the case device is shown in Table 3-4. The flowchart shown in
of a 64-Kbyte device (8 panels with an 8-byte buffer per Figure 3-5 depicts the logic necessary to completely
panel), 64 bytes will be simultaneously programmed write a PIC18FXX80/XX85 device. The timing diagram
during each programming sequence. In this case, the that details the “Start Programming” command and
offset of the write within each panel is the same (see parameters P9 and P10 is shown in Figure 3-6.
Figure 3-4). Multi-Panel Write mode is enabled by Note: The TBLPTR register must contain the
appropriately configuring the Programming Control same offset value when initiating the pro-
register located at 3C0006h. gramming sequence as it did when the
write buffers were loaded.
Panel n
TBLPTR<21:13> = (n – 1)
Panel 3
TBLPTR<21:13> = 2
Panel 2
TBLPTR<21:13> = 1
Panel 1
TBLPTR<21:13> = 0
To continue writing data, repeat steps 2 through 5, where the Address Pointer is incremented by 8 in each panel at each iteration of
the loop.
Start
N=1
LoopCount = 0
Configure
Device for
Multi-Panel Writes
Load 8 Bytes
N=N+1 to Panel N Write
Buffer at <Addr>
All
No Panel Buffers
Written?
N=1 Yes
LoopCount =
LoopCount + 1 Start Write Sequence
and Hold PGC
High until Done
No All
Locations
Done?
Yes
Done
FIGURE 3-6: TABLE WRITE AND START PROGRAMMING INSTRUCTION TIMING (‘1111’)
P10
1 2 3 4 1 2 3 4 5 6 15 16 1 2 3 4 1 2 3
PGC P9
P5 P5A
PGD 1 1 1 1 n n n n n n n n 0 0 0 0 0 0 0
4-Bit Command 16-Bit Data Payload 4-Bit Command Programming Time 16-Bit
Data Payload
PGD = Input
Step 9: Load write buffer for panel. The correct panel will be selected based on the Table Pointer.
To continue writing data, repeat step 8, where the Address Pointer is incremented by 8 at each iteration of the loop.
PGC
P5 P5A
PGD 0 0 0 0 n n
4-Bit Command BSF EECON1, WR Poll WR Bit, Repeat Until Clear 16-Bit Data
(see below) Payload
PGD = Input
1 2 3 4 1 2 15 16 1 2 3 4 1 2 15 16
PGC
P5 P5A P5 P5A
Poll WR Bit
PGD 0 0 0 0 0 0 0 0
4-Bit Command MOVF EECON1, W, 0 4-Bit Command MOVWF TABLAT Shift Out Data
(see Figure 4-4)
Note 1: See Figure 4-4 for details on shift out data timing.
Step 3: Set Table Pointer for configuration byte to be written. Write even/odd addresses.(2)
0000 00 00
0000 00 00
0000 00 00
0000 00 00
Note 1: If the code protection bits are programmed while the program counter resides in the same block, then the interaction of
code protection logic may prevent further table write. To avoid this situation, move the program counter outside the
code protection area (e.g., GOTO 100000h).
2: Enabling the write protection of Configuration bits (WRTC = 0 in CONFIG6H) will prevent further writing of Configuration
bits. Always write all the Configuration bits before enabling the write protection for Configuration bits.
Start Start
Program Program
LSB MSB
Execute Execute
Four NOPs Four NOPs
Done Done
Step 2: Read memory into table latch and then shift out on PGD, LSb to MSb.
1001 00 00 TBLRD *+
1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4
PGC
P5 P6 P5A
P14
Start
Does Does
No No
Word = Expect Failure, Word = Expect Failure,
Data? Report Data? Report
Error Error
Yes Yes
All All
No Code Memory No ID Locations
Verified? Verified?
Yes Yes
Done
1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4
PGC
P5 P6 P5A
P14
4.5 Verify Data EEPROM Given that “Blank Checking” is merely code and data
EEPROM verification with FFh expect data, refer to
A data EEPROM address may be read via a sequence of Section 4.2 “Verify Code Memory and ID Locations”
core instructions (4-bit command, ‘0000’) and then out- and Section 4.4 “Read Data EEPROM Memory” for
put on PGD via the 4-bit command, ‘0010’ (Shift Out implementation details.
Data Holding register). The result may then be immedi-
ately compared to the appropriate data in the program-
FIGURE 4-5: BLANK CHECK FLOW
mer’s memory for verification. Refer to Section 4.4
“Read Data EEPROM Memory” for implementation
details of reading data EEPROM. Start
The Device ID Word for the PIC18FXX80/XX85 2: While in Low-Voltage ICSP mode, the
devices is located at 3FFFFEh:3FFFFFh. These bits RB5 pin can no longer be used as a
may be used by the programmer to identify what device general purpose I/O.
type is being programmed and read out normally even
after code or read-protected.
5.6 Embedding Data EEPROM should be issued. Similarly, when saving a HEX file, all
Information in the HEX File data EEPROM information must be included. An option
to not include the data EEPROM information may be
To allow portability of code, a PIC18FXX80/XX85 provided. When embedding data EEPROM information
programmer is required to read the data EEPROM in the HEX file, it should start at address F00000h.
information from the HEX file. If data EEPROM infor-
Microchip Technology Inc. believes that this feature is
mation is not present, a simple warning message
important for the benefit of the end customer.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
01/05/10