Professional Documents
Culture Documents
RA4
RA3
RA2
RA0
RA1
NC
NC
FIGURE 2-1: 18-PIN DIAGRAM FOR
PIC16F1847 AND
26
23
27
24
22
28
25
RA5/MCLR/VPP 1 21 RA7
PIC16LF1847 NC 2 20 RA6
VSS 3 19 VDD
PDIP, SOIC NC 4 PIC16F1847 18 NC
VSS PIC16LF1847
5 17 VDD
RA2 1 18 RA1 NC 6 16 RB7/ICSPDAT
RB0 7 15 RB6/ICSPCLK
12
13
14
RA0
8
9
RA3
11
10
2 17
RA4
NC
NC
3 16 RA7
RB1
RB3
RB2
RB5
RB4
RA5/MCLR/VPP 4 15 RA6
PIC16LF1847
PIC16F1847
VSS 5 14 VDD
RB0 6 13 RB7/ICSPDAT
RB1 7 12 RB6/ICSPCLK
RB2 8 11 RB5 FIGURE 2-4: 8-PIN DIAGRAM FOR
RB3 RB4
PIC12F1840/PIC12LF1840
9 10
PDIP, SOIC
PIC12LF1840
PIC16F1847 AND
PIC12F1840
RA5 2 7 RA0/ICSPDAT
PIC16LF1847 RA4 3 6 RA1/ICSPCLK
SSOP RA3/MCLR/VPP 4 5 RA2
RA2 1 20 RA1
RA3 2 19 RA0
RA4 3 18 RA7
FIGURE 2-5: 8-PIN DIAGRAM FOR
RA5/MCLR/VPP 4 17 RA6
PIC12F1840/PIC12LF1840
PIC16LF1847
PIC16F1847
VSS 5 16 VDD
VSS 6 15 VDD DFN
RB0 7 14 RB7/ICSPDAT
RB1 8 13 RB6/ICSPCLK VDD 1 8 VSS
PIC12LF1840
PIC12F1840
7FFFh
8002h User ID Location
8000h
Implemented
8003h User ID Location
8200h
8004h Reserved
8005h Reserved
800Bh-81FFh Reserved
7FFFh
8002h User ID Location
8000h
Implemented
8003h User ID Location
8200h
8004h Reserved
8005h Reserved
800Bh-81FFh Reserved
R R R R R R R
DEV1 DEV0 REV4 REV3 REV2 REV1 REV0
bit 6 bit 0
Note 1: Enabling Brown-out Reset does not automatically enable Power-up Timer.
2: The entire data EEPROM will be erased when the code protection is turned off during an erase.
3: The entire program memory will be erased when the code protection is turned off.
Note 1: The LVP bit cannot be programmed to 0 when Programming mode is entered via LVP.
2: This bit must be programmed as a 1.
1 2 3 4 5 6 1 2 15 16
TDLY
ICSPCLK
0 0 0 0 0 X 0 LSb MSb 0
ICSPDAT
1 2 3 4 5 6 1 2 15 16
TDLY
ICSPCLK
0 1 0 0 0 X 0 LSb MSb 0
ICSPDAT
1 2 3 4 5 6 1 2 15 16
TDLY
ICSPCLK
1 1 0 0 0 X 0 LSb MSb 0
ICSPDAT
1 2 3 4 5 6 1 2 15 16
TDLY
ICSPCLK
0 0 1 0 0 X
ICSPDAT
(from Programmer)
1 2 3 4 5 6 1 2 15 16
TDLY
ICSPCLK
1 0 1 0 0 X
ICSPDAT
(from Programmer)
Next Command
1 2 3 4 5 6 1 2 3
TDLY
ICSPCLK
0 1 1 0 0 X X X X
ICSPDAT
Address Address + 1
ICSPCLK
0 1 1 0 1 X X X X
ICSPDAT
N 0000h
Address
Next Command
1 2 3 4 5 6 1 2 3
TPINT
ICSPCLK
0 0 0 1 0 X X X X
ICSPDAT
0 0 0 1 1 X 0 1 0
ICSPDAT
ICSPCLK
0 1 0 1 1 X X X X
ICSPDAT
Address 8000h-8008h:
Program Memory is erased
Configuration Words are erased
User ID Locations are erased
If CPD = 0, Data Memory is erased
A Bulk Erase Program Memory command should not
be issued when the address is greater than 8008h.
Next Command
1 2 3 4 5 6 1 2 3
TERAB
ICSPCLK
ICSPDAT 1 0 0 1 0 X X X X
4.3.12 BULK ERASE DATA MEMORY After receiving the Bulk Erase Data Memory command,
the erase will not complete until the time interval,
To perform an erase of the data memory, after a Bulk
TERAB, has expired.
Erase Data Memory command, wait a minimum of
TERAB to complete Bulk Erase. Note: Data memory will not erase if code-
To erase data memory when data code-protect is active protected (CPD = 0).
(CPD = 0), the Bulk Erase Program Memory command
should be used.
Wait a minimum of
TERAB
Next Command
1 2 3 4 5 6 1 2
ICSPCLK
ICSPDAT
1 1 0 1 X X X 0
Next Command
1 2 3 4 5 6 1 2 3
TERAR
ICSPCLK
ICSPDAT 1 0 0 1 X
0 X X X
Start
Enter
Programming Mode
Bulk Erase
Device
Write Program
Memory(1)
Write Data
Memory(3)
Verify Program
Memory
Verify Data
Memory
Write Configuration
Words(2)
Verify Configuration
Words
Exit Programming
Mode
Done
Start
Bulk Erase
Program
Memory(1, 2)
Program Cycle(3)
Read Data
from
Program Memory
Report
No
Data Correct? Programming
Failure
Yes
Increment
No All Locations
Address
Done?
Command
Yes
Done
Note 1: This step is optional if device has already been erased or has not been previously programmed.
2: If the device is code-protected or must be completely erased, then Bulk Erase device per Figure 5-8.
3: See Figure 5-3 or Figure 5-4.
Program Cycle
Load Data
for
Program Memory
Begin Begin
Programming Programming
Command Command
(Internally timed) (Externally timed)
End
Programming
Command
Wait TDIS
Program Cycle
Load Data
for Latch 1
Program Memory
Increment
Address
Command
Load Data
for Latch 2
Program Memory
Increment
Address
Command
Load Data
for Latch n
Program Memory
Begin Begin
Programming Programming
Command Command
(Internally timed) (Externally timed)
End
Programming
Command
Wait TDIS
Start
Load
Configuration
Bulk Erase
Program
Memory(1)
One-word
Program Cycle(2)
(User ID)
Read Data
From Program
Memory Command
No Report
Data Correct? Programming
Failure
Yes
Increment
Address
Command
No Increment
Address = Yes Address
8004h? Command
Increment
Address
Command
Increment
Address
Command
One-word
Program Cycle(2)
(Config. Word 1)
Read Data
From Program
Memory Command
No Report
Data Correct? Programming
Failure
Yes
Increment
Address
Command
One-word
Program Cycle(2)
(Config. Word 2)
Note 1: This step is optional if device is erased or not previously programmed. Done
2: See Figure 5-3.
Start
Bulk Erase
Data Memory
Data
Program Cycle(1)
Read Data
From Data
Memory Command
Report
No
Data Correct? Programming
Failure
Yes
Yes
Done
Program Cycle
Load Data
for
Data Memory
Begin Begin
Programming Programming
Command Command
(Internally timed) (Externally timed)
End
Programming
Command
Wait TDIS
Start
Load Configuration
Bulk Erase
Program Memory
Bulk Erase
Data Memory
Done
VPP
VIHH VIL
VPP
VDD
VIL
VDD ICSPDAT
ICSPCLK
ICSPDAT
ICSPCLK
FIGURE 8-4: PROGRAMMING MODE
EXIT VDD LAST
TEXIT
VIHH VDD
VPP
ICSPDAT
VIL
VDD ICSPCLK
ICSPDAT
ICSPCLK
ICSPCLK
TDS TDH
ICSPDAT
as
input
TCO
ICSPDAT
as
output
TLZD
ICSPDAT
from input
to output THZD
ICSPDAT
from output
to input
TDLY
1 2 3 4 5 6 1 2 15 16
ICSPCLK
X X X X X X 0 LSb MSb 0
ICSPDAT
Next
Command Payload
Command
TDLY
1 2 3 4 5 6 1 2 15 16
ICSPCLK
X X X X X X
ICSPDAT
(from Programmer)
x LSb MSb 0
ICSPDAT
(from Device)
Next
Command Payload
Command
VDD
MCLR
TENTS
TENTH
33 clocks
TCKH TCKL
ICSPCLK
TDH
TDS
LSb of Pattern MSb of Pattern
ICSPDAT 0 1 2 ... 31
VDD
MCLR
TENTH
33 Clocks
TCKH TCKL
ICSPCLK
TDH
TDS
LSb of Pattern MSb of Pattern
ICSPDAT 0 1 2 ... 31
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 Microchips 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 Microchips 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.
ISBN: 978-1-60932-472-8
08/04/10