2002 Microchip Technology Inc. DS39025F-page 5
PIC16F87X
2.4 Program/Verify Mode
The Program/Verify mode is entered by holding pins
RB6 and RB7 l ow, w hile r aisin g MCLR pin from VIL to
VIHH (high voltage). In this mode, the state of the RB3
pin does not effect programming. Low voltage ICSP
Programm ing mo de is en tered by rais ing RB 3 from VIL
to VDD and then applying VDD to MCLR. Once in this
mode, the u se r p rog ram m em ory and t he co nfiguration
memory can be accessed and programmed in serial
fashion . The mode of oper ation is serial , and the mem-
ory that is accessed is the user program memory. RB6
and RB7 are Schmitt Trigger Inputs in this mode.
The seque nce that enters the de vice in to the Program -
ming/Verify mode place s all other log ic into the RESET
state (the MCLR pin was initially at VIL). This means
that all I/O are in the RESET state (high impedance
inputs).
The normal sequence for programming is to use the
load data command to set a value to be written at the
selected address. Issue the begin programming com-
mand followed by read data command to verify, and
then increment the address.
A device RESET will clear the PC and set the address
to 0. The “increment ad dress” com m and will incre me nt
the PC. The “load configuration” co mman d wil l se t the
PC to 0x2000. The available commands are shown in
Table 2-2.
2.4.1 LOW VOLTAGE ICSP
PROGRAMMING MODE
Low voltage ICSP Programming mode allows a
PIC16 F87 X devi ce to be pro gra mmed usin g VDD only.
Howeve r , when th is mode is ena bled by a co nfiguratio n
bit (LVP), the PIC16F87X device dedicates RB3 to
control entry/exit into Programming mode.
When LVP bit is set to ‘1’, the low voltage ICSP pro-
gramming entry is enabled. Since the LVP configura-
tion bit allows low voltage ICSP programming entry in
its erased stat e, an eras ed dev ic e w il l ha ve the LVP bit
enabled at the factory. While LVP is ‘1’, RB3 is dedi-
cated to low voltage ICSP program ming. Bring RB3 to
VDD and then MCLR to VDD to enter programming
mode. All other specifications for high voltage ICSP™
apply.
To disable low voltag e ICSP mode, the LVP bit mus t be
programmed to ‘0’. This must be done while entered
with Hi gh V ol tage En try mode (LVP bit = 1). R B3 is now
a general purpose I/O pin.
2.4.2 SERIAL PROGRAM/VERIFY
OPERATION
The RB6 pin is used as a clock input pin, and the RB7
pin is used for entering command bits and data
input/output during serial operation. To input a com-
mand, the clock pin (RB6) is cycled six times. Each
comma nd bit i s latche d on the falli ng edge of the clock ,
with the Least Significant bit (LSb) of the command
being input first. The data on pin RB7 is required to
have a minimum setup and hold time (see AC/DC
specifications), with respect to the falling edge of the
clock . Command s tha t have dat a as socia ted wit h them
(read and load) are specif ied to ha ve a mi nimum delay
of 1 µs between the command and the data. After this
delay, the clock pin is cycled 16 times with the first cycle
being a STAR T bit and the la st cycl e being a STOP bi t.
Data is also input and output LSb first.
Therefore, during a read operation, the LSb will be
transmi tted on to p in R B7 o n t he rising edge of t he sec -
ond cycle, and during a load operation, the LSb will be
latched on the falling edge of the second cycle. A min-
imum 1 µs del ay is also spec ified b etwe en con secu tive
commands.
All command s are transmitted LSb first . Data words are
also transmitted LSb first. The data is transmitted on
the rising edge and latched on the falling edge of the
clock . To allow for decoding of command s and reversa l
of data pin configuration, a time separation of at least
1µs is required between a command and a data word
(or another command).
The commands that are available are:
2.4.2.1 Load Configuration
After receiving this command, the program counter
(PC) will be set to 0x2000. By then applying 16 cycles
to the clock pin, the chip will load 14-bits in a “data
word,” as described above, to be programmed into the
configuration memory. A description of the memory
mapping schemes of the program memory for normal
operation and Configuration mode operation is shown
in Figure 2-1. After the configuration memory is
entered, the only way to get back to the user program
memory is to exit the Program/Verify Test mode by
taking MCLR low (VIL).
2.4.2.2 Load Data for Program Memory
After receiving this command, the chip will load in a
14-bit “data word” when 16 cycles are applied, as
described previously . A timing diagram for the load data
comma nd is sh own in Figu re 6-1.
Note: The OSC must not have 72 osc clocks
while the devic e MCLR i s bet we en VIL and
VIHH.