PIC16F88X Memory Programming Specification
PIC16F88X Memory Programming Specification
PIC16F88X Memory Programming Specification
MCLR/VPP/RE3 1 28 RB7/ICSPDAT
RA0/AN0/ULPWU/C12IN0- 2 27 RB6/ICSPCLK
RA1/AN1/C12IN1- 3 26 RB5/AN13/T1G
RA2/AN2/VREF-/CVREF/C2IN+ 4 25 RB4/AN11/P1D
PIC16F882/883/886
RA3/AN3/VREF+/C1IN+ 5 24 RB3/AN9/PGM/C12IN2-
RA4/T0CKI/C1OUT 6 23 RB2/AN8/P1B
RA5/AN4/SS/C2OUT 7 22 RB1/AN10/P1C/C12IN3-
VSS 8 21 RB0/AN12/INT
RA7/OSC1/CLKIN 9 20 VDD
RA6/OSC2/CLKOUT 10 19 VSS
11 18 RC7/RX/DT
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2 12 17 RC6/TX/CK
13 16 RC5/SDO
RC2/CCP1/P1A
RC3/SCK/SCL 14 15 RC4/SDI/SDA
MCLR/VPP/RE3
RB5/AN13/T1G
RB4/AN11/P1D
RB6/ICSPCLK
RB7/ICSPDAT
28
27
26
24
23
22
25
RA2/AN2/VREF-/CVREF/C2IN+ 1 21 RB3/AN9/PGM/C12IN2-
RA3/AN3/VREF+/C1IN+ 2 20 RB2/AN8/P1B
RA4/T0CKI/C1OUT 3 19 RB1/AN10/P1C/C12IN3-
RA5/AN4/SS/C2OUT 4 PIC16F882/883/886 18 RB0/AN12/INT
VSS 5 17 VDD
RA7/OSC1/CLKIN 6 16 VSS
RA6/OSC2/CLKOUT 7 15 RC7/RX/DT
10
12
13
14
11
8
9
RC3/SCK/SCL
RC1/T1OSI/CCP2
RC5/SDO
RC0/T1OSO/T1CKI
RC2/CCP1/P1A
RC4/SDI/SDA
RC6/TX/CK
MCLR/VPP/RE3 1 40 RB7/ICSPDAT
RA0/AN0/ULPWU/C12IN0- 2 39 RB6/ICSPCLK
RA1/AN1/C12IN1- 3 38 RB5/AN13/T1G
RA2/AN2/VREF-/CVREF/C2IN+ 4 37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
RD2
RD1
RD0
44
43
42
41
40
39
37
36
35
34
38
RC7/RX/DT 1 33 RA6/OSC2/CLKOUT
RD4 2 32 RA7/OSC1/CLKIN
RD5/P1B 3 31 VSS
RD6/P1C 4 30 VSS
RD7/P1D 5 29 NC
VSS 6 PIC16F884/887 28 VDD
VDD 7 27 RE2/AN7
VDD 8 26 RE1/AN6
RB0/AN12/INT 9 25 RE0/AN5
RB1/AN10/C12IN3- 10 24 RA5/AN4/SS/C2OUT
RB2/AN8 11 23 RA4/T0CKI/C1OUT
22
12
13
14
15
16
17
18
19
20
21
RB6/ICSPCLK
MCLR/VPP/RE3
RA0/AN0/ULPWU/C12IN0-
RA1/AN1/C12IN1-
NC
RB7/ICSPDAT
RB5/AN13/T1G
RA3/AN3/VREF+/C1IN+
RB4/AN11
RA2/AN2/VREF-/CVREF/C2IN+
RB3/AN9/PGM/C12IN2-
Implemented
07FF
Program Memory
Maps to
User ID Location 0-7FF
2000
1FFF
2002 User ID Location 2000
Implemented
2004 Reserved
2005 Reserved
Maps to Configuration Memory
Device ID 2000-203F
2006
200A-207F Reserved
Implemented
0FFF
Program Memory
Maps to
User ID Location 0-FFF
2000
1FFF
2002 User ID Location 2000
Implemented
2004 Reserved
2005 Reserved
Maps to Configuration Memory
Device ID 2000-203F
2006
200A-207F Reserved
1FFF
2002 User ID Location 2000
Implemented
2004 Reserved
2005 Reserved
Maps to Configuration Memory
Device ID 2000-203F
2006
200A-207F Reserved
ICSPCLK
TDLY2
1 2 3 4 5 6 1 2 3 4 5 15 16
ICSPCLK
TDLY2
1 2 3 4 5 6 1 2 3 4 5 15 16
ICSPCLK
1 2 3 4 5 6 1 2 3 4 5 15 16
ICSPCLK
TDLY3
1 1 0 0 x x stp_bit
ICSPDAT strt_bit
LSb
MSb on 9th falling edge
TDLY1
TDLY2
1 2 3 4 5 6 1 2 3 4 5 15 16
ICSPCLK
TDLY3
1 0 0 1 0 x x MSb stp_bit
ICSPDAT strt_bit
LSb
TSET1
THLD1 TDLY1
TDLY2
1 2 3 4 5 6 1 2 3 4 5 15 16
ICSPCLK
TDLY3
1 0 1 0 x x stp_bit
ICSPDAT strt_bit
LSb MSb on 9th falling edge
TSET1
THLD1 TDLY1
TDLY2
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
0 1 1 0 x x x 0
ICSPDAT
TSET1
THLD1
TDLY1
TPROG1
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
0 0 0 1 0 x x 0
ICSPDAT
TSET1
THLD1
VIHH
MCLR TPROG2
End Programming Command
1 2 3 4 5 6 1 2
ICSPCLK
ICSPDAT 0 0 0 1 1 x x 0
TSET1
THLD1
VIHH
MCLR
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
ICSPDAT 0 1 0 1 0 x x 0
TDIS
TSET1
THLD1
TERA
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
1 0 0 1 x x x 0
ICSPDAT
TSET1 TSET1
THLD1 THLD1
TERA
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
1 1 0 1 x x x 0
ICSPDAT
TSET1
THLD1
TERA
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
1 0 0 0 1 x x 0
ICSPDAT
Start
Bulk Erase
Program Program Cycle
Memory(1),(3)
Load Data
for
One-word Program Memory
Program Cycle
Begin Begin
Read Data Programming Programming
from Command Command
Program Memory (Internally timed) (Externally timed)
Report
No
Data Correct? Programming
Wait TPROG1 Wait TPROG2
Failure
Yes
Increment End
No All Locations
Address Programming
Done?
Command
Yes
Program Data
Memory(2) Wait TDIS
Figure 3-19
Program
User ID/Config. bits
Figure 3-18
Done
Note 1: This step is optional if device has already been erased or has not been previously programmed.
2: This step is optional if the data memory does not require updates.
3: If the device is code-protected or must be completely erased, then Bulk Erase device per Figure 3-21.
Load Data
for
Program Memory
Increment
Address
Start Command
Bulk Erase
Load Data
Program
for
Memory(1),(4)
Program Memory
Four-word Increment
Program Cycle Address
Command
Program
Load Data
User ID/Config. bits
for
Figure 3-18
Program Memory
Done
Begin Begin
Programming Programming
Command Command
(Internally timed) (Externally timed)
End
Programming
Wait TDIS
Program Cycle
Load Data
for Latch 1
Program Memory
Start Increment
Address
Command
Bulk Erase
Program
Memory(1,4) Load Data
Latch 2
for
Program Memory
Eight-word
Program Cycle
Increment
No All Locations
Address
Done?
Command
Yes Increment
Address
Program Data
Command
Memory(2,3)
(Figure 3-19)
Load Data
Program for Latch 8
User ID/Config. bits Program Memory
(Figure 3-18)
Begin Begin
Done Programming Programming
Command Command
(Internally timed) (Externally timed)
End
Programming
Wait TDIS
Start
Load
Configuration
Program Cycle
Bulk Erase
Program
Memory Load Data
for
Program Memory
One-word
Program Cycle
(User ID) Begin Begin
Programming Programming
Command Command
Read Data (Internally timed) (Externally timed)
From Program
Memory Command
Increment
No Address = Yes
Address
0x2004?
Command (x3)
One-word
Program Cycle
(Config. Word 1)
Increment
Address
Command
One-word
Program Cycle
(Config. Word 2)
Read Data
From Program
Memory Command
Report
No
Data Correct? Programming
Failure
Yes
Done
Start
Program Cycle
Bulk Erase
Data Memory
Load Data
for
Data Memory
Program Cycle
Begin Begin
Programming Programming
Read Data Command Command
From Data (Internally timed) (Externally timed)
Memory Command
Done
Start
Bulk Erase
Program Memory
Load Configuration
Bulk Erase
Program Memory
Bulk Erase
Data Memory
Done
Note: This sequence does not erase the Calibration Word at address 2009h.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Default value ‘1’ = Bit is erased ‘0’ = Bit is programmed
P = Programmable bit x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Default value ‘1’ = Bit is erased ‘0’ = Bit is programmed
P = Programmable bit x = Bit is unknown
Legend:
R = Readable bit P = Programmable bit U = Unimplemented bit, read as ‘1’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared
x = Bit is unknown
bit 13 Unimplemented
bit 12-6 FCAL<6:0>: Internal Oscillator Calibration bits(2)
0111111 = Maximum frequency
•
•
0000001
0000000 = Center frequency. Oscillator is running at the calibrated frequency
1111111
•
•
1000000 = Minimum frequency
bit 5-3 POR<2:0>: POR Calibration bits(2)
111 = Maximum POR voltage
110 =
101 =
100 = Center POR voltage
000 = Center POR voltage
001 =
010 =
011 = Minimum BOR voltage
bit 2-0 BOR<2:0>: BOR Calibration bits(2)
111 = Maximum POR voltage
110 =
101 =
100 = Center POR voltage
000 = Center POR voltage
001 =
010 =
011 = Minimum BOR voltage
Note 1: This location does not participate in Bulk Erase operations.
2: The calibration bits must be read, preserved, then replaced by the user during Program Memory Bulk Erase operation with PC = 2009h.
PIC16F882 CP = 1 SUM[0x0000:0x07FF] + (CFG1 & 0x3FFF) + (CFG2 & 0x0700) 0x3EFF 0x0ACD
CP = 0 (CFG1 & 0x3FFF) + (CFG2 & 0x0700) + SUM_ID 0x85BE 0x518C
PIC16F883 CP = 1 SUM[0x0000:0x0FFF] + (CFG1 & 0x3FFF) + (CFG2 & 0x0700) 0x36FF 0x02CD
CP = 0 (CFG1 & 0x3FFF) + (CFG2 & 0x0700) + SUM_ID 0x7DBE 0x498C
PIC16F884 CP = 1 SUM[0x0000:0x0FFF] + (CFG1 & 0x3FFF) + (CFG2 & 0x0700) 0x36FF 0x02CD
CP = 0 (CFG1 & 0x3FFF) + (CFG2 & 0x0700) + SUM_ID 0x7DBE 0x498C
PIC16F886 CP = 1 SUM[0x0000:0x1FFF] + (CFG1 & 0x3FFF) + (CFG2 & 0x0700) 0x26FF 0xF2CD
CP = 0 (CFG1 & 0x3FFF) + (CFG2 & 0x0700) + SUM_ID 0x6DBE 0x398C
PIC16F887 CP = 1 SUM[0x0000:0x1FFF] + (CFG1 & 0x3FFF) + (CFG2 & 0x0700) 0x26FF 0xF2CD
CP = 0 (CFG1 & 0x3FFF) + (CFG2 & 0x0700) + SUM_ID 0x6DBE 0x398C
Legend: CFG = Configuration Word. Example calculations assume Configuration Word is erased (all ‘1’s).
SUM[a:b] = [Sum of locations a to b inclusive]
SUM_ID = User ID locations masked by 0xF then made into a 16-bit value with ID0 as the Most Significant
nibble.
For example, ID0 = 0x1, ID1 = 0x2, ID3 = 0x3, ID4 = 0x4, then SUM_ID = 0x1234.
The 4 LSbs of the unprotected checksum is used for the example calculations.
*Checksum = [Sum of all the individual expressions] MODULO [0xFFFF]
+ = Addition
& = Bitwise AND
• 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.
12/08/06