Microchip Technology PICkit 3 User Manual Download Page 26

Theory of Operation

©

 2009 Microchip Technology Inc.

DS51795A-page 21

2.6.1

Sequence of Operations Leading to Debugging

Given that the requirements for debugging (see previous section) are met, these 
actions can be performed when the PICkit 3 programmer/debugger is set as the current 
debugger from the MPLAB IDE menu (

Debugger>Select Tool>PICkit 3

):

• The application code is compiled/assembled by selecting 

Project>Build 

Configuration>Debug

.

• When 

Debugger>Program

 is selected, the application code is programmed into 

the device’s memory via the ICSP protocol as described above.

• A small “debug executive” program is loaded into the high area of program 

memory of the target device automatically by MPLAB IDE. Since the debug 
executive must reside in program memory, the application program must not use 
this reserved space. Some devices have special memory areas dedicated to the 
debug executive. Check your device data sheet for details.

• Special “in-circuit debug” registers in the target device are enabled. These allow 

the debug executive to be activated by the debugger.

• The target device is held in reset by keeping the V

PP

/MCLR line low.

2.6.2

Debugging Details

Figure 2-7 illustrates the PICkit 3 programmer/debugger system when it is ready for 
debugging.

FIGURE 2-7:

PICkit™ 3 DEBUGGER READY FOR DEBUGGING

Typically, in order to find out if an application program will run correctly, a breakpoint is 
set early in the program code. When a breakpoint is set from the user interface of 
MPLAB IDE, the address of the breakpoint is stored in the special internal debug 
registers of the target device. Commands on PGC and PGD communicate directly to 
these registers to set the breakpoint address.

Next, the 

Debugger>Run

 function or the Run icon (forward arrow) is usually pressed 

from MPLAB IDE. The debugger will then tell the debug executive to run. The target 
will start from the reset vector and execute until the Program Counter reaches the 
breakpoint address previously stored in the internal debug registers.

After the instruction at the breakpoint address is executed, the in-circuit debug 
mechanism of the target device “fires” and transfers the device’s Program Counter to 
the debug executive (much like an interrupt) and the user’s application is effectively 

+5V

+12V

4.7 k

4.7 k

Internal Circuits

Program

Memory

File

Registers

Internal

Debug

Registers

V

PP

/MCLR

PGC

PGD

1

5

4

Executive

Debug

Area Used by 

Target

be 

Running

must

for Debug
Executive
to Function

Area 

V

DD

Hardware
Stack Shared
by Debug Exec 

Debug Exec

Reserved 

for Debug

 Executive

Summary of Contents for PICkit 3

Page 1: ...ss mainly focus on the distribution of electronic components Line cards we deal with include Microchip ALPS ROHM Xilinx Pulse ON Everlight and Freescale Main products comprise IC Modules Potentiometer...

Page 2: ...2009 Microchip Technology Inc DS51795A PICkit 3 Programmer Debugger User s Guide...

Page 3: ...hnology Incorporated in the U S A All other trademarks mentioned herein are property of their respective companies 2009 Microchip Technology Incorporated Printed in the U S A All Rights Reserved Print...

Page 4: ...19 2 6 Requirements for Debugging 20 2 7 Programming 22 2 8 Resources Used by the Debugger 22 Chapter 3 Installation 3 1 Introduction 23 3 2 Installing the Software 23 3 3 Connecting the Target 23 3 4...

Page 5: ...8 2 Specific Error Messages 41 8 3 General Corrective Actions 44 Chapter 9 Debugger Function Summary 9 1 Introduction 49 9 2 Debugging Functions 49 9 3 Debugging Dialogs Windows 51 9 4 Programming Fun...

Page 6: ...tion 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 sit...

Page 7: ...apter 5 PICkit 3 Debug Express Provides basic information on using the PICkit 3 Debug Express Chapter 6 Troubleshooting First Steps Begins the troubleshooting process by identifying first steps and co...

Page 8: ...h right angle bracket A menu path File Save Bold characters A dialog button Click OK A tab Click the Power tab Text in angle brackets A key on the keyboard Press Enter F1 Courier New font Plain Sample...

Page 9: ...ent 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...

Page 10: ...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 click on Customer Change Notification and follo...

Page 11: ...n 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 list...

Page 12: ...UIDE 2009 Microchip Technology Inc DS51795A page 7 Part 1 Getting Started Chapter 1 Overview 9 Chapter 2 Theory of Operation 15 Chapter 3 Installation 23 Chapter 4 General Setup 27 Chapter 5 PICkit 3...

Page 13: ...PICkit 3 User s Guide DS51795A page 8 2009 Microchip Technology Inc NOTES...

Page 14: ...cuit Serial Programming 2 wire serial interfaces In addition to debugger functions the PICkit 3 programmer debugger system also may be used as a development programmer The debugger system executes cod...

Page 15: ...onnector Connect the PICkit 3 to the PC using the supplied USB cable 1 2 3 Pin 1 Marker This marker designates the location of pin 1 for proper connector alignment 1 2 4 Programming Connector The prog...

Page 16: ...HOW THE PICKIT 3 PROGRAMMER DEBUGGER HELPS YOU The PICkit 3 programmer debugger allows you to Debug your application on your own hardware in real time Debug with hardware breakpoints Set breakpoints b...

Page 17: ...o the debugger 3 CD ROM with MPLAB IDE software and on line documentation FIGURE 1 3 BASIC DEBUGGER SYSTEM Additional hardware that may be ordered separately PICkit 3 Debug Express Kit which includes...

Page 18: ...ull speed emulation C C C Hardware breakpoints C C C Peripheral freeze 2 C C C Break on data fetch or write C C C Break on stack overflow N N N Stopwatch C C N Pass counter C C C WDT overflow C C N St...

Page 19: ...e C C C Full speed emulation C C C Hardware breakpoints C C C Peripheral freeze 1 C C C Break on data fetch or write C C N Break on stack overflow C C N Stopwatch C N N Pass counter C C N WDT overflow...

Page 20: ...Debugger 2 2 PICkit 3 VS PICkit 2 The PICkit 3 programmer debugger system is similar in function to the PICkit 2 in circuit debugger system Similarities of the two debuggers include Powered via USB ca...

Page 21: ...igure 2 2 For more on standard communication see Chapter 10 Hardware Specification FIGURE 2 1 STANDARD DEBUGGER SYSTEM DEVICE WITH ON BOARD ICE CIRCUITRY FIGURE 2 2 STANDARD DEBUGGER SYSTEM ICE DEVICE...

Page 22: ...11 CONNECTION AT TARGET 2 4 2 Target Connection Circuitry Figure 2 4 shows the interconnections of the PICkit 3 programmer debugger to the connector on the target board The diagram also shows the wiri...

Page 23: ...nefit for very small applications that have the device VDD separated from the rest of the application circuit for independent programming but is not recommended for general usage as it imposes more cu...

Page 24: ...vent bidirectional communication between the debugger and the target device 2 5 DEBUGGING There are two steps to using the PICkit 3 programmer debugger system as a debugger The first requires that an...

Page 25: ...cating with the MPLAB IDE software via the USB cable See Chapter 3 Installation for details The debugger must be connected as shown to the VPP PGC and PGD pins of the target device with the modular in...

Page 26: ...llustrates the PICkit 3 programmer debugger system when it is ready for debugging FIGURE 2 7 PICkit 3 DEBUGGER READY FOR DEBUGGING Typically in order to find out if an application program will run cor...

Reviews: