dinsdag 11 november 2008

ICSP for PIC microcontrollers

Microcontrollers are modified by a so-called "programmer". The first programmers you use usually have a socket that allows you to insert the microcontroller, after which you can update its internal memory. It is, however, much more convenient to leave the microcontroller in the circuit, and program it by hooking up the programmer to your circuit. This is called ICSP and relatively easy when one uses a PicKit 2 (I believe there is a PicKit 3 too, but I have little experience with it). The PicKit 2 accepts a regular 6 pin socket, so a simple header pin suffices. The schematic shows how to hook it up. If you align the pins with the PIC16F688 (or PIC16F690, or any other "modern" PIC) you only need to add two wires: Vdd (+5V) and MCLR.

Make sure that the end is marked, so the user can match the white triangle on the PicKit 2 correctly. Note that you should put a 0.1uF decoupling capacitor over the microcontroller, as marked in the circuit. If you are using some of the pins that are used by the ICSP, make sure they do not draw a lot of current away from the PicKit 2 (or other programmer that you might be using). Also avoid hooking up components that are sensitive to higher voltages, as you can't be certain what voltage will come out of the programmer.

Geen opmerkingen: