User`s guide
Walk-Through and Detailed Tutorial
© 2006 Microchip Technology Inc. DS51519B-page 55
3.14 CHOOSING A DEBUGGER
Choose a tool to help debug your code from Debugger>Select Tool. Microchip provides
several types of debug tools:
• MPLAB SIM simulator – Simulate device operation in software.
• MPLAB ICD 2 in-circuit debugger – Debug your code in the device using an ICD
and special Flash devices with built-in debug circuitry. See the Readme file in the
MPLAB IDE directory for a list of supported devices.
• MPLAB ICE 4000 in-circuit emulator – Emulate larger-memory PIC18 MCU’s and
dsPIC DSC’s operation in hardware, with access to device memory locations.See
the Readme file in the MPLAB IDE directory for a list of supported devices.
• MPLAB ICE 2000 in-circuit emulator – Emulate most PICmicro MCU’s operation
in hardware, with access to device memory locations. See the Readme file in the
MPLAB IDE directory for a list of supported devices.
Once you have chosen a debug tool, you will see changes in the following on the IDE:
• Debugger menu – Several standard options will be available. Other tool-specific
options may also appear. Most of these options also will be available from the
right mouse button menu in either the source code (file) window or Program
Memory window.
• View menu – Depending on the debugger chosen, other debug options may
appear.
• Debug toolbar – Several standard options will be available. Other tool-specific
options may also appear.
• Status bar – The debug tool you have selected should now be shown.
Tutorial Step 13:
If you have purchased a hardware or third-party tool for application development, select
it now (Debugger>Select Tool
). If it is not visible, please consult the documentation that
came with the tool for proper installation and setup with MPLAB IDE.
If you do not have an additional tool, select the built-in simulator, MPLAB SIM.
3.15 RUNNING YOUR CODE
No matter what debug tool you select, you will need to run (execute) your code to
debug it.
•Select Debugger>Reset>Processor Reset
or press <F6>. There should be a solid
green arrow in the gutter of your source code window, indicating the first source
code line that will be executed.
•Select Debugger>Run
or press <F9> to run your application. You will see
“Running…” appear on the status bar. Also, the arrow in the gutter will appear
hollow.
• To halt program execution, select Debugger>Halt
or press <F5>. The line of code
where the application halted will be indicated by the solid green arrow.
• You may also single step through the application program by selecting
Debugger>Step Into
or press <F7>. This will execute the currently indicated line of
code and move the arrow to the next line of code that will be executed.
Note: You may click on the appropriate icon on the toolbar or use the hot key
shown next to the menu item instead of selecting the menu item. This is
usually the best approach for repeated running, halting and stepping when
debugging.