Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•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.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K
EELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, rfPIC and SmartShunt are registered
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
FilterLab, Linear Active Thermistor, MXDEV, MXLAB,
SEEVAL, SmartSensor and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
logo, PowerCal, PowerInfo,
PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Total
Endurance, UNI/O, WiperLock and ZENA are trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu, and then Topics to open a list of available on-line help files.
®
IDE on-line help.
INTRODUCTION
This chapter contains general information that will be useful to know before using
PICkit™ 2 . Items discussed include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
This document describes how to use the PICkit 2 as a development tool to emulate
and debug firmware on a target board. The manual layout is as follows:
Please complete the enclosed Warranty Registration Card and mail it promptly.
Sending in the Warranty Registration Card entitles users to receive new product
updates. Interim software releases are available at the Microchip web site.
RECOMMENDED READING
This user's guide describes how to use PICkit 2 . Other useful documents are listed
below. The following Microchip documents are available and recommended as
supplemental reference resources.
44-Pin Demo Board User’s Guide (DS41296)
Consult this document for instructions on how to use the 44-Pin demo board as a
development tool to emulate and debug firmware on a target board.
Low Pin Count Demo Board User’s Guide (DS51556)
Consult this document for instructions on how to use Microchip Technology’s low pin
count device (8-pin, 14-pin and 20-pin). This document includes a series of tutorials.
MPLAB
Describes how to set up the MPLAB IDE software and use it to create projects and
program devices.
MPLAB
Consult this document for more information pertaining to the installation and features
of the MPLAB Integrated Development Environment (IDE) software. An on-line Help
version is also available.
In-Circuit Serial Programmer™ (ICSP™) Guide (DS30277)
This document contains helpful design guidelines for successful ICSP programming. It
includes application notes on hardware designs and the ICSP programming
specifications.
Describes how to use the Microchip PIC
(MPLINK linker), and librarian (MPLIB librarian).
README for PICkit™ 2 Debug Express
For the latest information on using the PICkit 2 Debug Express, read the “Readme for
PICkit 2.htm” file (an HTML file) in the Readmes subdirectory of the MPLAB IDE
installation directory. The Readme file contains updated information and known issues
that may not be included in this user’s guide.
Readme Files
For the latest information on using other tools, read the tool-specific Readme files in
the Readmes subdirectory of the MPLAB IDE installation directory. The Readme files
contain updated information and known issues that may not be included in this user’s
guide.
Microchip provides online support via our web site at www.microchip.com. This web
site is used as a means to make files and information easily available to customers.
Accessible by using your favorite internet browser, the web site contains the following
information:
• Product Support – Data sheets and errata, application notes and sample
programs, design resources, user’s guides and hardware support documents,
latest software releases and archived software
• General Technical Support – Frequently Asked Questions (FAQs), technical
support requests, online discussion groups, Microchip consultant program
member listing
• Business of Microchip – Product selector and ordering guides, latest Microchip
press releases, listing of seminars and events, listings of Microchip sales offices,
distributors and factory representatives
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip
products. Subscribers will receive e-mail notification whenever there are changes,
updates, revisions or errata related to a specified product family or development tool of
interest.
To register, access the Microchip web site at www.microchip.com
Change Notification and follow the registration instructions.
The Development Systems product group categories are:
• Compilers – The latest information on Microchip C compilers and other language
tools. These include the MPLAB C18 and MPLAB C30 C compilers; MPASM™
and MPLAB ASM30 assemblers; MPLINK™ and MPLAB LINK30 object linkers;
and MPLIB™ and MPLAB LIB30 object librarians.
• Emulators – The latest information on Microchip in-circuit emulators.This
includes the MPLAB REAL ICE™ and MPLAB ICE 2000 in-circuit emulators.
• In-Circuit Debuggers – The latest information on the Microchip in-circuit
debuggers. This includes the MPLAB ICD 2 and PICkit™ 2.
• MPLAB
Integrated Development Environment for development systems tools. This list is
focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB Editor and
MPLAB SIM simulator, as well as general editing and debugging features.
• Programmers – The latest information on Microchip programmers. These include
the MPLAB PM3 device programmer and the PICSTART
PICkit 2 development programmers.
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document. See our web site
for a complete, up-to-date listing of sales offices.
Technical support is available through the web site at: http://support.microchip.com
This chapter introduces the PICkit 2 Development Programmer/Debugger features and
PICkit 2 Programmer application menu functions.
This chapter discusses:
• PICkit
• PICkit 2 Development Programmer/Debugger
• PICkit 2 Programmer Application
1.2PICkit 2 DEVELOPMENT PROGRAMMER/DEBUGGER CONTENTS
The PICkit 2 Development Programmer/Debugger kit contains the following items:
1. The PICkit 2 Development Programmer/Debugger
2. USB cable
3. PICkit Starter Kit and MPLAB IDE CD-ROMs
Additionally, the PICkit 2 Starter Kit and PICkit 2 Debug Express kit both contain a
demo board with a PIC microcontroller device.
2 Development Programmer/Debugger Contents
1.3PICkit 2 DEVELOPMENT PROGRAMMER/DEBUGGER
The PICkit 2 Development Programmer/Debugger is a low-cost development programmer. It is capable of programming most of Microchip’s Flash microcontrollers and serial
EEPROM devices. For specific device support, see the README file included on the
PICkit 2 Starter Kit CD-ROM.
Note:The PICkit 2 is intended for development programming. For production
programming, please consider the MPLAB PM3 device programmer or
other third party programmers designed for a production environment.
New device support can be added by updating the programming software. The latest
software is available on Microchip’s web site page for the PICkit 2:
w
ww.microchip.com/pickit2.
The PICkit 2 also may be used to debug selected devices. See Chapter 4. “PICkit 2 Debug Express” for more details.
2 – Push Button4 – USB Port Connection6 – Programming Connector
5
1.3.1USB Port Connection
The USB port connection is a USB mini-B connector. Connect the PICkit 2 to the PC using
the supplied USB cable.
1.3.2Status LEDs
The Status LEDs indicate the status of the PICkit 2.
1. Power (green) – Power is applied to the PICkit 2 via the USB port.
2. Tar g e t (yellow) – The PICkit 2 is powering the target device.
3. Busy (red) – The PICkit 2 is busy with a function in progress, such as
programming.
1.3.3Push Button
The push button may be used to initiate the Write Device programming function when
Programmer>Write on PICkit Button
application menu (see item labeled 2 in Figure 1-1.)
The push button may also be used to put the PICkit 2 unit operating system firmware
into Bootloader mode. For more information on this feature, see Chapter 6. “Updating the PICkit 2 Operating System”.
is checked on the PICkit 2 Programmer
1.3.4Programming Connector
The programming connector is a 6-pin header (0.100" spacing) that connects to the
target device. See the pinout specification in Figure 1-2.
For more information on how to use the PICkit 2 with In-Circuit Serial Programming
(ICSP), refer to Chapter 3. “Using In-Circuit Serial Programming™ (ICSP™)”.
The PICkit 2 Programmer application allows you to program all supported devices
listed in the PICkit 2 Readme file. The programming interface appears as shown in
Figure 1-3. Its controls are listed in the following sections.
For more information on how to install and use the PICkit 2 Programmer application,
see Chapter 2. “PICkit 2 Programmer Getting Started”.
The menu bar selects various functions of the PICkit 2 Programmer application. A
summary of the functions are:
File
•Import Hex – Import a hex file for programming. The hex file format INHX32 is
supported.
• Export Hex
INHX32 format.
• File History
These recent hex files may be selected to quickly import them. Note that the file
history will initially be blank on a new installation until a hex file is imported.
•Exit
– Exit the program.
Device Family
Select a device family to search for a connected device in that family. Selecting the
device family of the current part will clear all device data.
Some families which cannot be auto-detected (such as Baseline) will bring up a drop
down box from which supported devices may be selected.
– Export a hex file read from a device.The hex file is created in the
– Up to the last four hex files opened are displayed with their filepath.
Programmer
• Read Device – Reads program memory, data EEPROM memory, ID locations and
Configuration bits.
• Write Device
Configuration bits.
•Verify
•Erase
• Blank Check
• Verify on Write
• Hold Device in Reset
• Write on PICkit Button
– Verifies program memory, data EEPROM memory, ID locations and
Configuration bits read from the target MCU against the code stored in the
programming application.
– Performs a Bulk Erase of the target MCU. OSCCAL and band gap values
are preserved on parts with these features.
memory, ID locations and Configuration bits.
programming on a Write (recommended). When unchecked, the device will be
programmed but not verified on a Write.
(asserted). When unchecked, the pin is released (tri-stated), allowing an external
pull-up to bring the device out of Reset.
pressing the PICkit 2 push button.
– Writes program memory, data EEPROM memory, ID locations and
– Performs a Blank Check of program memory, data EEPROM
– When checked, the device will be immediately verified after
– When checked, the MCLR (VPP) pin is held low
– When checked, a Write operation will be initiated by
Tools
• Enable Code Protect – Enables code protection features of the microcontroller on
future Write operations.
Note:To disable code protect, all device memory must be erased and rewritten.
•E
nable Data Protect – Enables data protection feature of microcontrollers with
data EEPROM memory on future Write operations.
Note:To disable data protect, all device memory must be erased and rewritten.
•Set OSCCAL – Allows the OSCCAL value to be changed for devices where it is
stored in the last location of Program Memory.
• Targe
•Calibrate
•Use V
•Fast Programming
• Check Communication
• UART Tool…
• Troubleshoot
• Download
t VDD Source
-Auto-Detect – The PICkit 2 will automatically detect whether the target device
has its own power supply or needs to be powered by the programmer on each
operation.
-Force
PICkit 2 – The PICkit 2 will always attempt to supply VDD to the target
device.
- Force Target
– The PICkit 2 will always assume the target has its own power
supply.
VDD & Set Unit ID – Opens a wizard that steps the user through calibrat-
ing the PICkit 2 V
DD supplied voltage so it is more accurate, and optionally
assigning a Unit ID to identify between multiple PICkit 2 devices.
PP First Program Entry – When checked, it allows the PICkit 2 to connect to
and program devices with configurations and code that interferes with the ICSP
signal pins, preventing PICkit 2 from detecting them. Using this feature requires
that the PICkit 2 supplies V
– When checked, the PICkit 2 will attempt to program the
device as fast as possible. When unchecked, the PICkit 2 will slow down ICSP
communication. This may be helpful for targets with loaded ICSP lines.
communication with a target device by attempting to identify the connected device
by its device ID.
- Puts the PICkit 2 in UART Mode and opens a terminal-like
interface for communicating with a PIC MCU device program through the USART
pins. See Chapter 7. “PICkit 2 UART Tool” for more information.
... – Opens a wizard to help with troubleshooting connectivity from
the PICkit 2 to the target device. This is most useful where the programmer is
unable to detect the target device at all.
PICkit 2 Programmer Operating System – Performs a download of the
PICkit 2 operating system (firmware).
DD to the target.
– Verifies USB communication with the PICkit 2 and ICSP
Help
•PICkit2 User’s Guide – Attempts to launch the user’s guide PDF (Adobe® Reader
must be installed).
• 44-Pin Demo Board Guide
– Attempts to launch the 44-Pin Demo Board User’s
Guide PDF (Adobe Reader must be installed).
• LPC Demo Board Guide
– Attempts to launch the Low Pin Count Demo Board
User’s Guide PDF (Adobe Reader must be installed).
• PICkit 2 P
rogrammer on the web – Opens www.microchip.com/pickit2 in the
default web browser.
• Readme
• About
– Opens the PICkit 2 Readme.txt file.
– Opens a dialog with the PICkit 2 Programmer application version, device
file version and firmware version.
1.4.2Device Configuration
The Device Configuration window displays the device, User ID, Configuration Word
and Checksum. It also displays OSCCAL and Band Gap for parts with those features.
For baseline (12-bit core) devices, serial EEPROM devices, and KeeLoq
devices, you must select the device from the Device drop-down menu.
All other part family devices will be detected by their device ID and the part name will
be displayed on the Device line.
1.4.3Status Window
The status window displays text status of the operations in progress. If an operation is
successful, the status window will display a green background. If an operation fails, the
status window will display red. If an operation alerts a caution, the status window will
display yellow.
1.4.4Progress Bar
The progress bar displays the progress of an operation.
1.4.5Device VDD
The PICkit 2 VDD may be turned on and off by clicking the checkbox “On”. The voltage
may be set in the box on the right either by typing it directly or using the up/down arrows
to adjust it a tenth of a volt at a time. The maximum and minimum allowed voltages will
vary depending on the target device.
If the “On” checkbox is unchecked, PICkit 2 will automatically turn on the V
voltage during any requested programming operation.
DD at the set
FIGURE 1-4:PICKIT™ 2 SUPPLIED V
DD
If the target device has its own power supply, then the PICkit 2 will display the detected
V
DD voltage in the box on the right, which will be grayed out to prevent being changed.
The checkbox text changes to “check”, and clicking on the checkbox will update the
detected V
checkbox will revert the V
DD voltage value. If Ta rg e t V DD>Auto-Detect is selected, clicking on the
DD mode back to PICkit 2 supplied VDD if a target power
supply is no longer detected.
FIGURE 1-5:TARGET SUPPLIED V
DD
1.4.6Device MCLR State
The “/MCLR” checkbox shown in Figure 1-4 and Figure 1-5 has the same functionality
as the menu selection Programmer
the target device will be held in Reset. When unchecked, the target circuit is allowed to
pull MCLR
up to VDD to release the device from Reset. This function can be used to
prevent a device from executing code before and after programming.
>Hold Device in Reset. When the box is checked
Note:If the target device allows the MCLR pin to be configured as an input port,
and it is configured as such, PICkit 2 will not be able to hold the device in
Reset.
The Source bar displays the source of the currently loaded device data. If read from a
hex file, it will display the hex file name. If read from a device, it will display the part
name. None (Empty/Erased) indicates the buffers are empty, and it will display
Edited once Program Memory or Data EEPROM Memory has been edited in the
window.
1.4.8Program Memory
Program code can be loaded into the PICkit 2 Programmer application by selecting
File>Import HEX
The origin of the code is displayed in the Source block. The Program Memory window
displays the program code in hexadecimal. The code may be edited in the window.
The checkbox next to the Program Memory window is only available on devices with
EEPROM data memory. If the box is checked, then Program Memory, User IDs, and
Configuration Words are written to, read from, and verified on the device. If the box is
unchecked, then Program Memory, User IDs, and Configuration Words will not be
erased or altered during a Write Device operation, and will not be read or verified. The
checkbox does not affect Erase Device or Blank Check operations. Both memory
window checkboxes may not be cleared at the same time.
For supported serial EEPROM devices, the device contents are displayed in the Program Memory window instead of the Data EEPROM Memory window for easier viewing
in the larger display area.
to import a hex file or by clicking Read to read the device memory.
1.4.9Data EEPROM Memory
Similar to Program Memory above, data EEPROM code can be loaded into the PICkit 2
Programmer application by selecting File>Import HEXRead to read the device memory. The origin of the code is displayed in the Source
block. The Data EEPROM Memory window displays the program code in hexadecimal.
The code may be edited in the window.
The check box next to the EEPROM Data window controls whether the EEPROM Data
memory is written, read and verified. If the box is checked, then the device EEPROM
will be overwritten with the window data. If the box is not checked, then the device
EEPROM will not be erased or altered during a Write Device operation. The checkbox
does not affect Erase Device or Blank Check operations. Both memory window
checkboxes may not be cleared at the same time.
This chapter gives instruction on how to get started using the PICkit 2 Development
Programmer/Debugger to program Flash-based PIC microcontroller units.
For information on how to use the PICkit 2 with In-Circuit Serial Programming™
(ICSP™), refer to Chapter 3. “Using In-Circuit Serial Programming™ (ICSP™)”.
For information on how to update the PICkit 2 operating system (firmware), refer to
Chapter 6. “Updating the PICkit 2 Operating System”.
For information on using the PICkit 2 as a debugger in MPLAB IDE, see Chapter
4. “PICkit 2 Debug Express”.
• Installing the PIC
• Installing and Launching the PICkit 2 Programmer Application
• Connecting to the Device
• Selecting Target Power
• Importing a Hex File
• Writing the Program to the Device
• Verifying the Device
• Reading Device Memory
• Code Protecting the Device
• Erasing and Blank Checking the Device
• Automating Write/Read Procedures
PICkit™ 2 USER’S GUIDE
kit 2 Hardware
2.2INSTALLING THE PICkit 2 HARDWARE
To install the PICkit 2 hardware:
• Plug one end of the USB cable into PICkit 2 USB connector. Plug the other end
into a USB port on your PC.
• Connect the PICkit 2 to a target board via a 6-pin connector. The target board can
be the included demo board or any target equipped with the appropriate 6-pin
connector.
• Do not connect the PICkit 2 to a target board that has its own power supply if it is
not connected to a powered USB port.
• To connect the PICkit 2 to a target with an MPLAB ICD 2 style RJ-11 connector,
the AC164110 RJ-11 to ICSP Adapter kit is required.
When plugging the PICkit 2 into the USB, it is recommended to disconnect it from any
target board first. Similarly, when starting up or rebooting the host PC, ensure it is
disconnected from a target.
For more information about the PICkit 2 hardware, see Section 1.3 “PICkit 2 Development Programmer/Debugger”.
2.3INSTALLING AND LAUNCHING THE PICkit 2 PROGRAMMER APPLICATION
Insert the PICkit 2 Starter Kit CD-ROM into the CD-ROM drive. In a few moments, the
introductory screen should be displayed. Follow the directions on the screen for
installing the PICkit 2 Programmer application.
If the introductory screen does not appear, browse to the CD-ROM directory and open
the PICkit_Starter_Kit_Welcome.htm file.
Once installed, start the PICkit 2 Programmer application by selecting
Start>Programs>Microchip>PICkit 2
Figure 2-1. A listing of its features and functions may be found in Section 1.4 “PICkit 2
Programmer Application”.
FIGURE 2-1:PICkit™ 2 PROGRAMMING APPLICATION
. The programming interface appears as shown in
2.4CONNECTING TO THE DEVICE
The PICkit 2 is capable of programming a variety of Flash-based Microchip PIC microcontrollers and serial EEPROM devices. Supported devices are listed in the PICkit 2
Readme file on the CD-ROM, which can also be viewed by selecting Help>Readme
When the PICkit 2 Programmer application is first opened, it will attempt to identify the
connected device by the device ID and display it in the Configuration window as shown
in Figure 2-2.
If the device on the target is not correctly identified, check the target power
(Section 2.5 “Selecting Target Power”) and device ICSP connections before
attempting to reselect or change the device.
At any time, the device family may be selected to search for connectivity to a device in
that family. To connect to a device once the application is already running, select the
device family by clicking on the Device Family menu as shown in Figure 2-3.
FIGURE 2-3:SELECT DEVICE FAMILY
If the Baseline (12-bit core), K
must select the specific device from the device drop-down box as shown in Figure 2-4.
These devices do not have a device ID and do not support automatic detection.
EELOQ
®
HCS or EEPROMs device family is selected, you
CAUTION
Ensure that the correct Baseline has been selected. These devices do not contain a
device ID to confirm device selection. Choosing the wrong Baseline may cause an
erasing of the OSCCAL value stored in the last memory location.
The PICkit 2 can supply power to the target or the target may be powered externally.
2.5.1Target Powered from PICkit 2
If you are going to power the target board from the PICkit 2, do not attach a power supply to the target or the PICkit 2 will sense it and not give you the option to use PICkit 2
power. For a target board not connected to an external power supply, you will see the
options displayed in Figure 2-5.
FIGURE 2-5:ENABLE POWER FROM PICkit™ 2
voltage
box
To enable power to the target device, check the V
The default setting is “Off”, i.e., the checkbox is unchecked.
Note:If a target power supply is not detected, the PICkit 2 will always supply
power to the target during programming, regardless of the V
“On” checkbox state.
The voltage supplied to the target may be adjusted before or after enabling power by
adjusting the V
If a short or heavy current load is detected on the programmer-supplied V
will receive an error and V
DD PICkit 2 voltage box (Figure 2-5).
DD will be automatically disabled. Refer to Figure 2-6.
DD PICkit 2 “On” checkbox as shown.
DD PICkit 2
DD, then you
CAUTION
The USB port current limit is set to 100 mA. If the target plus the PICkit 2 exceed this
current limit, the USB port may turn off. The target may be powered externally if
more power is required.
To avoid heavy current load errors, it is recommended to keep the target current
consumption below 25 mA. Large V
slow down the V
DD risetime. The allowed VDD rise time is 500 μs or less.
2.5.2Target Powered from External Supply
The target device may also be powered externally. By default, the PICkit 2 will automatically detect an externally powered board. The heading “V
to “V
DD Target”, the “On” checkbox will be replaced by a checkbox named “Check”, and
the detected V
Clicking the “Check” checkbox will update the detected V
voltage box. If no V
will return to supplying V
Note:The maximum external VDD that may be used with the PICkit 2 is 5.0 Volts.
DD voltage is displayed in the grayed out voltage box as in Figure 2-7.
DD voltage is detected when the checkbox is clicked, then PICkit 2
DD power to the target device.
The minimum external V
DD capacitances should also be avoided as they
DD PICkit 2” will be changed
DD voltage displayed in the
DD that may be used with the PICkit 2 is 2.5 Volts.
FIGURE 2-7:EXTERNALLY POWERED TARGET
2.6IMPORTING A HEX FILE
To import a compiled program (hex file) to be programmed into the target device, select
File>Import HEX
FIGURE 2-8:IMPORT HEX FILE
Example source code and hex files may be found under the Install\Lessons\
directory for the appropriate kit demo board on the PICkit 2 Starter Kit CD-ROM. The
hex file Reversible.hex from the folder 07 Reversible will be used.
Browse for the hex file and click Open. The code is displayed in the Program Memory
and EEPROM Data windows. The name of the hex file is displayed in the Source block
under Program Memory.
Note:The example lesson code is meant to be installed to the local hard drive
from the CD-ROM using the Setup files in the CD-ROM directory
Install/Lessons/. The lessons are covered in the user’s guide for the
included kit Demo Board, and this guide should be read before using the
lesson projects and source code.
FIGURE 2-9:EXAMPLE HEX FILE IMPORTED
The PICkit 2 Programmer application will warn you if the hex file does not contain any
Configuration Words. You can be sure these are included in the hex file by selecting
File>Export
MPLAB IDE usage, see Chapter 4. “PICkit 2 Debug Express”.)
You will also be warned that the hex file is larger than the selected device if the hex file
contains memory locations that do not exist in the current device. Any data for
non-existent locations will not be imported.
in MPLAB IDE to save a hex file including configuration memory. (For
2.7WRITING THE PROGRAM TO THE DEVICE
After a device family has been selected and a hex file has been imported, the target
device can be programmed by clicking Write (Figure 2-10). The device will be erased
and programmed with the hex code previously imported.
When erasing the device during programming, a Bulk Erase method is used. All Baseline, Mid-Range, and many dsPIC30F and PIC18F devices require a minimum V
the Bulk Erase. Some of these devices support a low voltage row erase method that
can be used at lower voltages, but this method takes longer to erase the device. See
the Readme file under Help>Readme
does not support row erasing, a dialog will pop up to warn you if the device V
the minimum required for a Bulk Erase.
Note:If any Code Protect, Data Protect, Write Protect, or Read Protect configu-
ration bits are currently set in the device, the Bulk Erase method must be
used prior to programming. The lower voltage row erase procedure will not
succeed.
FIGURE 2-10:BUTTONS – WRITE
The status of the Write operation is displayed in the status bar located under the Device
Configuration window. If the write is successful, the status bar turns green and displays
“Programming Successful”, as shown in Figure 2-11.
for devices that support this feature. If a device
DD for
DD is below
FIGURE 2-11:WRITE SUCCESSFUL STATUS
If the write fails, the status bar turns red and displays “Programming Failed”, as shown
in Figure 2-12. This error indicates that the data was corrupted during the programming
sequence. If this error is displayed, try writing the program to the device again. If the
error continues, see Chapter 5. “Troubleshooting” for assistance.
FIGURE 2-12:WRITE ERROR STATUS
Other write issues may be displayed as warnings and will turn the status bar yellow as
in Figure 2-13. In this case, the PICkit 2 and demo board had become disconnected.
If a device has EEPROM data memory, the “Enabled” checkbox next to Program
Memory and EEPROM Data will become available.
The checkboxes select which memory regions’ programming operations will be
affected. Refer to Table 2-1 for a description of how programming operations are
affected by the checkboxes. Erase and Blank Check always operate on all memory
regions.
TABLE 2-1:MEMORY REGION SELECTION
Program
Memory Enabled
CheckedCheckedAll Memory RegionsAll Memory Regions
Checked—Program Memory
—CheckedEEPROM onlyAll Memory Regions
——Not Allowed
EEPROM Data
Enabled
Write/Read/VerifyErase/Blank Check
All Memory Regions
User IDS
Configuration
During a Write, regions that are unchecked will remain unchanged in the device.
For example, if Program Memory is unchecked while EEPROM Data is checked, then
a Write operation will only write EEPROM Data, while Program Memory, User IDs and
Configuration Words in the device will remain unchanged.
If Program Memory is checked while EEPROM Data is unchecked, then a Write
operation will program Program Memory, User IDs and Configuration Words, while
EEPROM Data in the device will remain unchanged.
Due to programming constraints in some devices, the PICkit 2 Programmer application
may read and re-write EEPROM data memory during a Write to preserve it.
It is not allowed to have both memory regions unchecked.
2.7.2Automatic File Reload
Prior to each Write, the imported hex file time stamp is compared to the version on the
disk. If the version on the disk is newer, it is reloaded. This occurs only when a hex file
has been read from the disk.
This feature ensures that the latest version built will be written to the device. It may be
used with the Tools>Program on PICkit Button
IDE build without switching to the PICkit 2 Programmer software simply by pressing the
PICkit 2 unit push button.