Using MPLAB® ICD 2 Debugger

  Important :

To successfully use MPLAB® ICD 2 Debugger with generated .cof file, follow the steps below :

  1. First of all, start mikroBasic PRO for dsPIC30/33 and PIC24 and open the desired project. In this example, UART project for EasydsPIC4A board and dsPIC30F4013 will be opened.
  2. Open Tools › Options › Output settings, and check the "Generate COFF file" option, and click the OK button.
  3. After that, compile the project by pressing Ctrl + F9.
  4. Connect USB cable and turn on power supply on EasydsPIC4A.
  5. Program the MCU by pressing F11.
  6. 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 :
  7. MPLAB® ICD 2 Debugger Connection

  8. Connect second end of the modular interface cable to the ICD (RJ12) socket of EasydsPIC4A :
  9. Connecting modular interface cable to the EasyPIC6

  10. Put the J11 and J10 Jumpers in the correct position, as showed in the picture below :
  11. Setting jumpers in the correct position

  12. Next, open MPLAB®, and select the appropriate device by choosing Configure › Select Device... :
  13. Configure Device

  14. 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.

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

  15. 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 :
  16. Import COFF file

  17. Then, select the MPLAB® ICD 2 from the Debugger › Select Tool menu for hardware debugging :
  18. Select Debugger

  19. Complete the MPLAB® ICD 2 Setup Wizard from the Debugger menu (if needed).
  20. After completing MPLAB® ICD 2 Setup Wizard, click on the Debugger › Connect :
  21. Connect to the device

  22. Finally, click on the Debugger › Program :
  23. Program device

  24. Now, you can start debugging the code by clicking Step Over button Step Over Button on the Debug toolbar, or by pressing F8 :
  25. Code Debugging

Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code