In-Circuit Programming with the MPLAB ICD 2

Motivation

This tutorial explains how to program any of Microchip's 8-bit microcontrollers in-circuit. That is, you can program the micro without ever taking it out of the circuit board. This eliminates the need for heavy sockets and always worrying about breaking or bending the fragile pins of the microcontroller. This tutorial assumes the reader:

Parts List and Sources

US-based vendors to obtain material to complete this tutorial include

PART DESCRIPTIONVENDORPARTPRICE (2006)QTY
MPLAB ICD 2MicrochipDV164005159.991
PIC MicrocontrollerMicrochipPICxxFxxx1.00-8.001

Construction

The supplied cable to interface the ICD 2 with your circuit board is a 6-pin modular cable (a telephone cord with 2 additional wires). You can use this with a modular jack (Digikey part #: A9031) or you can use a 6x1 male header. This is the route we will take with this tutorial. To do this, solder/insert a 6x1 male header somewhere on your circuit board and make the appropriate connections as shown in the schematic below:

Next, you will have to modify one end of the modular cable (supplied with the ICD 2) to fit the 6-pin header created in the previous step. To do this, plug one end of the 6-pin modular cable into the ICD 2. Next, take the other end of the modular cable and note the colors of pins 1-6 (i.e. pin 1 is blue, pin 2 is yellow, etc.).

After know the color and pin number of each cable, it is safe to cut the modular jack off the end of the cable. Strip the cable to gain access to all 6 of the wires inside. Then, using a 6-pin female header and some wire crimps, create a connector which will plug into the male header on your circuit board.

Setting Up the ICD 2

Step 1:
Note: Do not connect the MPLAB ICD 2 to your computer at this time!. First, you need to complete the MPLAB IDE software installation. You should have a CD that came with the MPLAB ICD 2. If not, you can download the IDE from Microchip's web site.

Step 2:
Now that the software is installed, go ahead and connect the MPLAB ICD 2 to your PC via the USB cable. Do not allow Windows to pick a USB driver. When the found new hardware wizard pops up, select "Install from a List or Specific Location (Advanced)". Make sure the "Search for Best Driver" is Selected and unselect "Search Removable Media". Also select "Include this location in the search". Browse to the following directory "C:\Program Files\Microchip\MPLAB IDE\ICD2\Drivers" and click Next.

Step 3:
The "Completing the Found New Hardware Wizard" screen will appear and click on Finish.

Step 4:
Next another "Found New Hardware Wizard" screen will pop up. This is for the installation of the Firmware Client. Follow the same procedure as in Steps 2 and 3.

Step 5:
Now the ICD 2 software is installed and ready to go, power your circuit board with 5V. If you have a program already burned to your microcontroller, it is okay. Once the MPLAB ICD 2 connects to your circuit it will interrupt the program.

Step 6:
Connect the unmodified end of the modular cable into the ICD 2 and the other end to the header on your circuit boardNow the ICD 2 software is installed and ready to go, power your circuit board with 5V. If you have a program already burned to your microcontroller, it is okay. Once the MPLAB ICD 2 connects to your circuit it will interrupt the program.

Step 7:
The next step is to configure you MPLAB IDE for the MPLAB ICD 2. Start MPLAB IDE and click on the Configure tab and select the PIC you will be programming. Then select Programmer => Select Programmer => MPLAB ICD 2. This should guide you through a self-explanatory setup wizard. Upon completing the wizard, your software is now ready to program your PIC in circuit!

Programming

Step 1:
To program the microcontroller in-circuit, you first have to import your hex file. To do this, select File => Import and navigate to the directory your hex file is located.

Step 2:
Finally, select Programmer => Program to program your PIC!!

This tutorial was created by B. Green: home page