Programming PIC18F Chips


The pin-out for Microchip standard 6-pin connector for In-Circuit Serial Programming (ICSP) is listed in table below:

Pin Function
1 _MCLR/Vpp (programming voltage)
2 Vcc(+5V)
4 Data
5 Clock
6 LVP (low-voltage programming mode control)


PICkit 2


There are many PIC programmer available, commercial and DIY devices. As Microchip introduces the new microprocessors the programming software got to be updated accordingly playing catch-up with the PIC manufacturer. That is the root of the problem with third-party PIC programmers. Microchip's PICkit 2 is the low cost ICSP programmer for Flash PICs with USB interface introduced by Microchip. Only subset of PIC microcontrollers is supported, but the list is including all the recent devices from PIC16, PIC18 and PIC24 families and certainly covers all the PICs you are most likely want to use. It is fully integrated with Microchip’s MPLAB IDE and allow not only program but debug applications as well. As alternative you can use the standalone programmer applet, see picture below.


The PICkit 2 has USB bootloader and capable of updating the programmer firmware directly from Microchip web site. Every time the PICkit 2 programmer application is launched, it will check the firmware version of the PICkit 2 to see if it is the latest version. If not, it will attempt to automatically download the latest version. The software upgrades are free and Microchip updates them in timely fashion. Even more, the firmware and schematic are freely available. Apparently Microchip has made the open design intentionally, see it as the way to boost using the popularity PIC microprocessors. With such simplicity of design it is easy to build a clone version. My first PIC programmer was Melabs EPIC device with parallel port interface. After upgrading my PC I have realized that parallel port became legacy these days, as the most of new PC motherboards do not have it all. The another annoying part about Melabs programmers in general is that even if you buy the full package (hardware + software) upgrades are not free and only beta stuff available for download. I have successfully burned all my PIC18 and PIC24 chips using PICkit 2 and would definitely recommend it.



PICkit 3

PICkit 3 was introduced recently and supersedes  the PICkit 2.It is build around PIC24FJ256GB106 16-bit PC device. The Microchip states that the PICkit 3 differs from the PICkit 2 by providing:

  • Extended EE program image space (512 Kbytes)
  • True voltage reference
  • Increased voltage range (1.8-5V VDD; 1.8-14V VPP)
  • Doesn't have standalone programming application and can be used only with Microchip IDE

Some of the latest PICs being supported by PICkit 3 but not PICkit 2, it looks like eventually PICkit 2 will be phased out.


DIY PICkit 2

PICkit 2 was originally built by Microchip as open design programmer with the schematic, source code and firmware available to boost the popularity of the PIC devices. Because of that it is easy to build a clone version of the original device. Most of the clones will produce unregulated 5 volt VPP where the original Microchip PICkit 2 provides adjustable VPP output to allow 3.3 and 2.5 volt parts programming. The schematic I have used is based on the original PICkit 2 without programmer-to-go functionality. That functionality allowing a hex file to be downloaded to the PICkit 2 to later program PIC microcontrollers without a PC with a simple pressing programmer's push button. I do not think that functionality is required for a hobbyist but allows simplify the schematic by omitting two 24C512 EEPROM chips. The Eagle Files designed using only thru-hole mounting parts.



Building PICKit 2 clone is facing a chicken-egg problem as another programmer is required to program the firmware into the PIC18F2550. Once the PIC18F2550 chip for PICKit 2 is programmed, you can the upgrade the firmware as it includes USB bootloader. The latest PICkit 2 firmware version is available from Microchip and the current version is also is available on the site - click here to download!



Parts List

The DIY PICkit 2 part list for the two the most popular electronic components vendors, Mouser and DigiKey is shown below.

Part Description Mouser # DigiKey #


USB type B connector 706-33UBBD-04SW11 609-1039-ND


PIC18F2550 579-PIC18F2550-I/SP PIC18F2550-I/SP-ND


MCP601P 579-MCP601IP MCP601-I/P-ND
Q1,Q4,Q6 BS250P,VP2106,ZVP3306A 689-VP2106N3-G ZVP3306A-ND
Q2,Q3,Q5,Q7 2N7000 512-2N7000TA 2N7000TACT-ND
D1,D2 BAT85 78-BAT85S 568-1617-1-ND
D3 Green 5mm LED 604-WP7113SGD 754-1263-ND
D4 Yellow 5mm LED 604-WP7113YD 754-1284-ND
D5 Red 5mm LED 604-WP7113ID 754-1264-ND
X1 Crystal, 20.000Mhz 815-ABL-20-B2 XC1723-ND
R1,R3,R4 10K Ohm 291-10K-RC 10KQBK-ND
R5,R10,R16 10K Ohm 291-10K-RC 10KQBK-ND
R2,R6,R7 470 Ohm 291-470-RC 470QBK-ND
R11 100 Ohm 291-100-RC 100QBK-ND
R9 2.7K Ohm 291-2.7K-RC 2.7KQBK-ND
R8,R13,R17,R18 4.7K Ohm 291-4.7K-RC 4.7KQBK-ND
R12 1K Ohm 291-1K-RC 1.0KQBK-ND
R14,R15 43 Ohm 291-43-RC 43QBK-ND
C1,C4,C7,C10,C11 0.1uF 871-B32529C104K189 495-2532-ND
C2,C3 22pF 140-50N2-220J-RC 490-4175-ND
C5,C8 10uF 647-UVR1V100MDD1TA 493-1036-ND
C6 0.47uF 871-B32529C474J 495-2560-3-ND
C9 47uF 16V 647-UVR1C470MDD1TD 493-1039-ND
L1 680uH 652-RLB0608-681KL 811-2051-ND
S1 Pushbutton 506-FSMCH 450-1665-ND


Setting Unit ID

The programmer can be assigned a Unit ID to identify it uniquely. After the fresh firmware programming the device applet is always showing the funny ID
"ID= OIHoss". It could be reset to not-assigned or set to any value by selecting “Tools>Calibrate VDD & Set Unit ID” menu, see picture below.



Calibration allows greater the VDD voltage accuracy. Note that as the calibration is dependent on the USB voltage and moving the PICkit 2 unit to a different USB port, to or from a USB hub or to another computer port may invalidate the calibration. To calibrate the PICkit 2 unit, a digital multi-meter is required. Disconnect the PICkit 2 unit from the target and select "Tools>Calibrate VDD & Set Unit ID". to bring up the calibration wizard. Follow the steps in the wizard to complete the calibration process.



Troubleshooting DIY PICkit2 assembly

You can use "Tools->Troubleshoot" menu to help with resolving connectivity from the PICkit 2 to the target device. This is also useful where there are the device assembling errors, as providing step-by-step output validation process.


PICkit 2 "El Cheapo"

El Cheapo was a PIC programmer presented by Myke Predko in his book Programming and Customizing the PIC Microcontroller.

I still have a circuit board included with the book to build the El Cheapo programmer somewhere around. This version of PICkit2 is inspired by the schematic of that programmer. If you do only PIC12, PIC16 and PIC18 5 volt PIC programming parts you can use it. The Eagle project is done using with thru-hole components and a single-layer layout.


Parts List

The DIY PICkit 2 part list for the two the most popular electronic components vendors, Mouser and DigiKey is shown below.

Part Description Mouser # DigiKey #


USB type B connector 706-33UBBD-04SW11 609-1039-ND


PIC18F2550 579-PIC18F2550-I/SP PIC18F2550-I/SP-ND
Q1,Q2 2N7000 512-2N7000TA 2N7000TACT-ND
Q3 BS250P,VP2106,ZVP3306A 689-VP2106N3-G ZVP3306A-ND
D1 Red 5mm LED 604-WP7113ID 754-1264-ND
D2 Green 5mm LED 604-WP7113SGD 754-1263-ND
D3,D4 BAT85 78-BAT85S 568-1617-1-ND
X1 Crystal, 20.000Mhz 815-ABL-20-B2 XC1723-ND
R1,R2 330 Ohm 291-330-RC 330QBK-ND
R3,R6 4.7K Ohm 291-4.7K-RC 4.7KQBK-ND
R4 2.7K Ohm 291-2.7K-RC 2.7KQBK-ND
R5 10K Ohm 291-10K-RC 10KQBK-ND
C1,C2 22pF 140-50N2-220J-RC 490-4175-ND
C3,C6 0.1uF 871-B32529C104K189 495-2532-ND
C4 10uF 647-UVR1V100MDD1TA 493-1036-ND
C5 0.47uF 871-B32529C474J 495-2560-3-ND
C7 47uF 16V 647-UVR1C470MDD1TD 493-1039-ND
L1 680uH 652-RLB0608-681KL 811-2051-ND
S1 Pushbutton 506-FSM4JH 450-1650-ND

Small MOSFETs like 2N7000 and BS250P are inexpensive and available these days. It can be any small-signal N-channel and P-channel MOSFETs. However, if there is a problem finding any these transistors you can use the regular NPN and PNP small-signal transistors.