Using MPLAB® ICD 2 Debugger
Important :
- It is assumed that MPLAB® and USB drivers for MPLAB® ICD 2 Debugger are previously installed.
- Procedure described below is also relevant for MPLAB® ICD 3 Debugger.
- Be sure to import compiled
.hexfile prior to importing.coffile, because it contains configuration bit settings which are essential for the proper functioning of the user code.
To successfully use MPLAB® ICD 2 Debugger with generated .cof file, follow the steps below :
- First of all, start mikroC PRO for PIC and open the desired project.
- Open Tools › Options › Output settings, and check the "Generate COFF file" option, and click the OK button.
- Next, enable Background Debug bit in the Edit Project menu.
- After that, compile the project by pressing Ctrl + F9.
- Connect USB cable and turn on power supply on EasyPIC6.
- Program the MCU by pressing F11.
- Connect external power supply, USB cable from PC and modular interface cable to the MPLAB® ICD 2 Debugger's appropiate sockets, like on the picture below :
- Connect second end of the modular interface cable to the EXT ICD (RJ12) socket of EasyPIC6 :
- Picture below illustrates the proper connection of ICD 2 to EasyPIC6 :
- Next, open MPLAB®, and select the appropriate device by choosing Configure › Select Device... For example, 16F887 MCU will be selected :
- After device selection, click on the File › Import. Open file dialog box should appear. Then, go to the project folder and open the generated HEX file,
UART.hex. - Next, click the File › Import. Open file dialog box should appear. Then, go to the project folder and open the generated COFF file,
UART.cof: - Then, select the MPLAB® ICD 2 from the Debugger › Select Tool menu for hardware debugging :
- Complete the MPLAB® ICD 2 Setup Wizard from the Debugger menu (if needed).
- After completing MPLAB® ICD 2 Setup Wizard, click on the Debugger › Connect :
- Finally, click on the Debugger › Program :
- Now, you can start debugging the code by clicking Step Over button
on the Debug toolbar, or by pressing F8 :




Note :
This is very important, because hex file contains configuration bit settings which are essential for the proper functioning of the user code.





Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
What do you think about this topic ? Send us feedback!



