Microchip Technology PICkit 2 User Manual

Microchip Technology PICkit 2 User Manual

Microcontroller programmer
Table of Contents

Advertisement

Quick Links

EN : Th is Dat asheet is pr esent ed by t he m anuf act ur er .
Please v isit our websit e f or pr icing and av ailabilit y at
w w w.hest or
e.hu.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PICkit 2 and is the answer not in the manual?

Questions and answers

Summary of Contents for Microchip Technology PICkit 2

  • Page 1 EN : Th is Dat asheet is pr esent ed by t he m anuf act ur er . Please v isit our websit e f or pr icing and av ailabilit y at w w w.hest or e.hu.
  • Page 2 PICkit Microcontroller Programmer USER’S GUIDE © 2006 Microchip Technology Inc. DS51553B...
  • Page 3 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.
  • Page 4: Table Of Contents

    MCLR pin............20 3.2.2 If the V pin is used as an I/O port pin............ 20 3.3 Isolate ICSPCLK or PGC and ICSPDAT or PGD pins ......... 20 3.4 V ....................... 21 © 2006 Microchip Technology Inc. DS51553B-page iii...
  • Page 5 PICkit 2 User’s Guide 3.4.1 The application circuit is powered by the PICkit 2 Microcontroller Programmer ....................21 3.4.2 The application circuit is powered externally ..........21 3.4.3 Bulk Erase is used ..................21 3.5 V ....................... 22 3.6 Other Considerations ................... 22 Chapter 4.
  • Page 6: Preface

    • Document Layout • Conventions Used in this Guide • Warranty Registration • Recommended Reading • The Microchip Web Site • Development Systems Customer Change Notification Service • Customer Support • Document Revision History © 2006 Microchip Technology Inc. DS51553B-page 1...
  • Page 7 The manual layout is as follows: • Chapter 1. “PICkit™ 2 Overview” – Provides an overview of the PICkit 2 Microcontroller Programmer. • Chapter 2. “Getting Started” – Provides Instructions on how to get started using ®...
  • Page 8 Curly brackets and pipe Choice of mutually exclusive errorlevel {0|1} character: { | } arguments; an OR selection var_name [, Ellipses... Replaces repeated text var_name...] void main (void) Represents code supplied by { ... user © 2006 Microchip Technology Inc. DS51553B-page 3...
  • Page 9 For the latest information on using the PICkit™ 2 Debug Express, read the “Readme for PICkit 2 Debug Express.txt” file (an ASCII text file) in the Readmes sub- directory 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.
  • Page 10 • Programmers – The latest information on Microchip programmers. These include ® ® the MPLAB PM3 and PRO MATE II device programmers and the PICSTART ™ Plus and PICkit 1 development programmers. © 2006 Microchip Technology Inc. DS51553B-page 5...
  • Page 11 Technical support is available through the web site at: http://support.microchip.com DOCUMENT REVISION HISTORY Revision A (July 2005) • Initial release of this document. Revision B (August 2006) • Updated Preface, added Chapter 4. “PICkit™ 2 Debug Express” tutorial. © 2006 Microchip Technology Inc. DS51553B-page 6...
  • Page 12: Introduction

    The latest firmware is available on Microchip’s web site at www.microchip.com. Note: The PICkit™ 2 Microcontroller Programmer is intended for development programming. For production programming, please consider the MPLAB PM3 Programmer or other third party programmers designed for the production environment. © 2006 Microchip Technology Inc. DS51553B-page 7...
  • Page 13: Pickit™ 2 Microcontroller Programmer Overview

    3. Busy (red) – The PICkit™ 2 Microcontroller Programmer is busy with a function such as Program mode or is alerting that a function is in progress. 1.5.3 Push Button The push button is for initiating a function that will be implemented in the near future. © 2006 Microchip Technology Inc. DS51553B-page 8...
  • Page 14: Programming Connector

    The 6-pin header (0.100" spacing) accepts 0.025" square pins. 1.5.5 Lanyard Connection To help prevent possible loss of the The PICkit™ 2 Microcontroller Programmer, a convenient laynard connection is available on the programmer. © 2006 Microchip Technology Inc. DS51553B-page 9...
  • Page 15: Programming Software

    PICkit 2 User’s Guide PROGRAMMING SOFTWARE Start the PICkit™ 2 Programming Software by selecting Start > Programs > PICkit 2 Microcontroller Programmer > PICkit 2. The programming interface appears, as shown in Figure 1-3. For more information on how to us the PICkit™ 2 Programming Software, see Chapter 2.
  • Page 16: Menu Bar

    • Check Board – Verifies communication with the PICkit™ 2 Microcontroller Programmer and reads the device ID of the target MCU. • Download PICkit 2 Operating System – Performs a download of the PICkit™ 2 Microcontroller Programmer firmware operating system.
  • Page 17: Device Configuration

    Data EEPROM Memory window will be programmed into and used to verify the device. If the box is not checked, the data EEPROM memory will not be programmed and it will not be used to verify the device. © 2006 Microchip Technology Inc. DS51553B-page 12...
  • Page 18: Chapter 2. Getting Started

    PICkit 2 USER’S GUIDE Chapter 2. Getting Started INTRODUCTION This chapter gives instruction on how to get started using the PICkit 2 Microcontroller ® Programmer to program Flash-based PICmicro microcontroller units (MCU). For information on how to use the PICkit 2 Microcontroller Programmer with In-Circuit Serial Programming™...
  • Page 19: Selecting The Device Family

    The PICkit 2 Microcontroller Programmer is capable of programming a variety of ® Flash-based Microchip PICmicro microcontrollers. The first step in using the PICkit 2 Microcontroller Programmer is to select the device family by clicking on the Device Family menu as shown in Figure 2-2. FIGURE 2-2: SELECT DEVICE FAMILY 2.3.2...
  • Page 20: Target Power

    CAUTION The USB port current limit is set to 100 mA. If the target plus PICkit 2 Microcontroller Programmer exceed this current limit, the USB port will turn off. The target may be powered externally if more power is required.
  • Page 21: Write

    Write operation is displayed in the status bar located under the Device Configuration window. Note: The device will be erased prior to programming. The PICkit 2 Microcontroller Programmer uses the bulk erase method that requires V voltage between 4.5 to 5.5V...
  • Page 22: Automatic File Reload

    2. Select Tools > Code Protect Device as shown in Figure 2-9. 3. Click Write. FIGURE 2-9: ENABLE CODE PROTECT Note: If the device is read after it has been code-protected, Program Memory and Data EEPROM Memory windows will display all zeros. © 2006 Microchip Technology Inc. DS51553B-page 17...
  • Page 23: Erase

    PICmicro MCU. To erase the device, click the Erase button. Note: The PICkit 2 Microcontroller Programmer uses the bulk erase method that requires V voltage between 4.5 to 5.5V. © 2006 Microchip Technology Inc.
  • Page 24: Introduction

    TYPICAL ICSP™ APPLICATION CIRCUIT Isolation Circuitry: Resistor or Schottky-type diode PICkit™ 2 Programming Header /MCLR ICSPDAT/PGD ICSPCLK/PGC 470 Ohm* 10k* RA0/ICSPDAT To Application RA1/ICSPCLK Circuit RA3/MCLR/V Target Microcontroller 0.1 µF* Device Typical Values © 2006 Microchip Technology Inc. DS51553B-page 19...
  • Page 25: Isolate Vpp /Mclr/Port Pin

    Isolation circuitry will vary according to the application. Figure 3-1 shows one possibility by using series resistors to isolate the ICSP signals from the application circuit. © 2006 Microchip Technology Inc. DS51553B-page 20...
  • Page 26: Vdd

    ) is +5V. CAUTION The USB port current limit is set to 100 mA. If the target plus PICkit 2 Microcontroller Programmer exceeds this current limit, the USB port will turn off. The target may be powered externally if more power is required.
  • Page 27: Vss

    Minimize the distance the ICSP signals must travel by placing the ICSP connector as close to the application circuit PICmicro MCU as possible. Minimize any cable length between the PICkit 2 Microcontroller Programmer and application circuit PICmicro MCU. The goal is to keep the ICSP signals within the level and slew rate specifications for successful programming.
  • Page 28: Chapter 4. Pickit™ 2 Debug Express

    Debug Express requires MPLAB IDE 7.40 version, or later. PICkit™ 2 DEBUG EXPRESS This section explains how to debug programs using the PICkit 2 Debug Express. It is intended for those new to debugging programs, but familiar with the MPLAB IDE software.
  • Page 29: Selecting The Device And Development Mode

    MPLAB IDE MENU BAR 2. Click on the Device drop-down list and select the PIC16F917 device. No other changes need to be made in this dialog box. 3. Click OK. FIGURE 4-2: SELECT DEVICE © 2006 Microchip Technology Inc. DS51553B-page 24...
  • Page 30: Pickit™ 2 Microcontroller Programmer Debug Tool

    FIGURE 4-3: PICkit 2 DEBUG TOOL FIGURE 4-4: OUTPUT WINDOW 4. Select Debugger > Settings to setup the PICkit 2 Microcontroller Programmer operation. 5. Click the “Connect on Startup” check box to enable the auto-connection feature. 6. Click Ok. FIGURE 4-5: PICkit 2 MICROCONTROLLER PROGRAMMER SETTINGS ©...
  • Page 31: Updating Pickit™ 2 Firmware (Operating System)

    PICkit™ 2 User’s Guide 7. Select Debugger > Connect to connect to the PICkit 2 Microcontroller Program- mer. The Output window displays communication status between the PICkit 2 Microcontroller Programmer and Target Board. FIGURE 4-6: PICkit 2 MICROCONTROLLER PROGRAMMER CONNECT 4.2.3...
  • Page 32: Running The Project Wizard

    2. Click Next to continue to Step One. FIGURE 4-8: PROJECT WIZARD 3. Select the PIC16F917 device from the Device drop-down box. 4. Click Next to continue to Step Two. FIGURE 4-9: STEP ONE © 2006 Microchip Technology Inc. DS51553B-page 27...
  • Page 33 • In Step Three, type in the name and location of the project or click the Browse button to locate the project files. • Click Next to continue to Step Four. FIGURE 4-11: STEP THREE © 2006 Microchip Technology Inc. DS51553B-page 28...
  • Page 34 In Step Four, add the project files: 1. From the left pane window, go to C:\Program Files\Microchip\PICkit 2\PIC16F917 Debug Demo.asm. Select and highlight the “PIC16F917 Debug Demo.asm” file and click the Add button. The file will be placed into the right pane window.
  • Page 35: Pic16F917 Debug Demo Project

    If needed, additional files can be added to the project using the Project Window. Right click on any of the files or folders in the Project Window tree to display a pop-up window with additional options for adding or removing files. FIGURE 4-15: ADDING AND REMOVING FILES © 2006 Microchip Technology Inc. DS51553B-page 30...
  • Page 36: Creating A Hex File

    Select Project > Build All, or right click on the project name in the Project Window and select “Build All” from the pop-up menu. The MPASM Assembler will create a hex file with the same name as the source .asm file. FIGURE 4-16: BUILD PROJECT FIGURE 4-17: OUTPUT WINDOW © 2006 Microchip Technology Inc. DS51553B-page 31...
  • Page 37: Setting Debug Options

    CONFIGURATION BIT SETTINGS 4.2.8 Loading Program Code for Debugging • Select Debugger > Select Tool > PICkit 2 to select the PICkit 2 Microcontroller Programmer as the debug tool. • Select Debugger > Program to program the PIC16F917 Debug Demo.hex file into the PIC16F917 on the 44-Pin Demo Board.
  • Page 38 PICkit™ 2 Debug Express FIGURE 4-19: Programming will only take a few seconds. During programming, the PICkit 2 Microcontroller Programmer tab of the Output dialog window will display the current phase of operation. When programming is complete, the dialog should look similar to Figure 4-20.
  • Page 39: Pic16F917 Debug Demo

    4.2.9 PIC16F917 Debug Demo The PICkit 2 Microcontroller Programmer executes in either Real-Time or Step mode. Real-Time execution occurs when the PIC16F917, on the 44-Pin Demo Board, is in the MPLAB IDE Run mode. Step mode execution can be accessed after the processor is halted.
  • Page 40: Debugging The Pic16F917 Debug Demo Code

    A breakpoint stops a program’s execution when the program executes the line marked as a breakpoint. 5. Hover over “ADRESH” in the listing file and it will show the value of the file register (see Figure 4-22). © 2006 Microchip Technology Inc. DS51553B-page 35...
  • Page 41 9. Select View > Watch to open a new Watch window. This window allows the user to watch the A/D register value change as the program executes. The Watch dialog opens with the Watch_1 tab selected, as shown in Figure 4-24. © 2006 Microchip Technology Inc. DS51553B-page 36...
  • Page 42 12. Select Debugger > Run to the run the program in Real-Time mode. This time the program will stop after it executes the breakpoint line of code and the instruction after the breakpoint will be indicated, as shown in Figure 4-26. FIGURE 4-26: PROGRAM HALTED AFTER BREAK © 2006 Microchip Technology Inc. DS51553B-page 37...
  • Page 43: Programming The Application

    The PICkit 2 Microcontroller Programmer must be reprogrammed for the changes to take effect. 16. Select Debugger > Program to reprogram the PICkit 2 Microcontroller Program- mer with the changes. When the PICkit 2 Microcontroller Programmer dialog indicates “Programming Succeeded”, the program is ready to run again.
  • Page 44 USER ID MEMORY 4. Set up the parameters for programming on the Programmer > Settings Program tab. 5. Select Programmer > Program. Now the PICkit 2 Microcontroller Programmer can reset and run the target. © 2006 Microchip Technology Inc. DS51553B-page 39...
  • Page 45 PICkit™ 2 User’s Guide NOTES: © 2006 Microchip Technology Inc. DS51553B-page 40...
  • Page 46: Introduction

    Step 1. Download the latest PICkit 2 Operating System from the Microchip web site at www.microchip.com. Step 2. From the menu, select Tools > Download PICKit 2 OS Firmware, as shown in Figure 5-1. FIGURE 5-1: DOWNLOAD PICkit 2 OPERATING SYSTEM Step 3.
  • Page 47 PICkit 2 User’s Guide NOTES: © 2006 Microchip Technology Inc. DS51553B-page 42...
  • Page 48: Chapter 6. Troubleshooting

    When the Verify or Read buttons are clicked, the Program Memory window comes up with all zeros. What is wrong? Answer The device may be code-protected. Ensure code protection has not been selected in the Configuration Word. © 2006 Microchip Technology Inc. DS51553B-page 43...
  • Page 49 2 User’s Guide ® ® Microsoft Windows 95/98/NT Question ® Windows 95/98/NT Can I run on Answer No. These operating systems either do not support USB or have drivers that are not compatible. © 2006 Microchip Technology Inc. DS51553B-page 44...
  • Page 50 +5V_USB +5V_USB +5V_USB 470Ω 470Ω 470Ω ICSP 0.1 µF POWER BUSY TARGET PIC18F2550/SO PROGRAM GREEN YELLOW RA0/AN0 FEEDBACK TGT FB RA1/AN1 RA2/AN2/V -/CV ICSPDAT RA3/AN3/V ICSPCLK RA4/T0CKI/C1OUT/RCV RA5/AN4/SS/HLVDIN/C2OUT MCLR TGT MCLR/V /RE3 33Ω RB0/AN12/INT0/FLT0/SDI/SDA RB1/AN10/INT1/SCK/SCL 22 pF RB2/AN8/INT2/VM0 20 MHz OSC1/CLKI RB3/AN9/CCP2/VP0 TGT N...
  • Page 51 +V_TGT 10Ω 33Ω TGT FB MMBT3906 10 µF 0.1 µF 4.7 KΩ FDC6420C 10 KΩ Q1(N) 1 KΩ TGT N 33Ω 10Ω ICSPCLK ZHCS1000 2.7 KΩ TGT P MMBT3906 Q2(P) MMBD4148 +V_TGT High turns on N 820Ω Low turns on P 10 KΩ...
  • Page 52: Worldwide Sales And Service

    ™ PICkit 2 User’s Guide NOTES: © 2006 Microchip Technology Inc. DS51553B-page 47...
  • Page 53 China - Wuhan Thailand - Bangkok Tel: 408-961-6444 Tel: 86-27-5980-5300 Tel: 66-2-694-1351 Fax: 408-961-6445 Fax: 86-27-5980-5118 Fax: 66-2-694-1350 Toronto China - Xian Mississauga, Ontario, Tel: 86-29-8833-7250 Canada Fax: 86-29-8833-7256 Tel: 905-673-0699 Fax: 905-673-6509 08/29/06 © 2006 Microchip Technology Inc. DS51553B-page 48...

Table of Contents