4.7.2.2 Sequence of Operations Leading to Debugging

Given that the 4.7.2.4 Requirements for Debugging are met, set the MPLAB PICkit Basic In-Circuit Debugger as the current tool in MPLAB X IDE. Right click on your project name and select Properties to open the Project Properties dialog, and then under Connected Hardware Tool, select a MPLAB PICkit Basic. If you have more than one tool connected, choose based on the serial number next to the tool name.

The following actions can now be performed:

  • When Debug > Debug Project is selected, the application code is programmed into the device’s memory via the ICSP protocol as described at the beginning of this section.
  • A small “debug executive” program is loaded into the memory of the target device. Since some architectures require that 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 by MPLAB X IDE. These allow the debug executive to be activated by the debugger. For more information on the device’s reserved resources, see 4.7.2.5 Resources Used by the Debugger.
  • The target device is run in Debug mode. To ensure the target will run, review 5.2 Top Reasons Why You Can't Debug, such as oscillator issues.
Figure 4-6. PIC® MCU Using Reserved Resources for Debug