For many hobbyists and students interested in programming PIC Microcontrollers, the high cost of a programmer can really be a huge obstacle. The programmer described in this article is very easy and cheap to build. It can cost you less than R 100 ($10) to build it and all the software used to program the PIC luckily are also free.

You can use MPLAB X IDE with XC8, XC16 or XC32 compilers from Microchip Technology Inc to write and debug codes for a PIC Microcontroller. You can download a free copy of  MPLAB® X IDE and XC8 Compiler from Microchip website. There are also other compilers that you can use depending on your preference, like Mikroelekronika compilers where you can download a free 2Kb limited demo compiler on their website. To be able to download the HEX file generated by our compiler into a target PIC, another third party software which is compatible with our programmer, IC-Prog Prototype Programmer can be downloaded for free from www.ic-prog.com

Power supply

The programmer is going to require it’s own power supply to generate the required programming voltage as well as the operating voltage. The required voltages for programming a PIC are at least 13V when downloading the code into the PIC and 5V for the normal operation of the PIC. Low voltage programming can also be used but is not always stable for all PICs so we are not going to discuss low voltage programming in this article. The 5V regulated is supplied by the 7805 voltage regulator and a charge pump is used to generate 13V by stepping up the voltage supplied by the rectifier bridge.    

Schottky diodes (1N5819) are used in this project rather than using the normal silicon rectifier diodes (1N4001), because their forward voltage drop is about 0.3V lower than the 0.7V silicon diodes. The voltage drop reduction is thus maximized  twice firstly to charge C6 and then to charge C7. A gain of about 0.6V is thus achieved.

Programming

In programming mode, ICPROG takes DB9 connector pin 3 high when transferring data to the programmer. This logic high switches on transistor Q1 which allows current to flow through the green LED to give an indication the the programmer is in programming mode. This same logic high on pin 3 is also used to switch on transistor Q2 which swiches on in turn transistor Q3. This causes the voltage on the MCLR Vpp pin of the PIC to go up to at least 13.5V enough to place the PIC in a programming mode. The interaction between the voltage levels created by ICPROG on pins 4 and 8 of the DB9 connector provide the data which is programmed into the PIC.

ICPROG Settings

After downloading ICPROG, when you run it for the first time, it will give you a message of: this is the first time you are using ICPROG, please configure your hardware settings.                                 

In the programmer drop down box, select JDM Programmer. In the Ports, select your appropriate serial COM Port that is free. In the Interface selection, select Direct I/O. In communication, leave all unchecked. Click OK.

Then go to the settings menu and select Options: There are ten tabs available.

  •  Confirmation tab: Tick on “Programming a device”
  • Programming tab: Tick on ” Verify during programming”
  • Leave the rest of the options at their default settings. Then click OK to close the option dialog box.
  • Select Settings menu again –> device –> Microchip PIC –> the select the PIC device that you are going to use.
  • Click OK.

You don’t have to repeat these settings again. you only need to do them once.

  • Once the PIC is correctly inserted in the programmer socket and the programmer is switched on, the go to File menu –> Open File, select the HEX file you want to program into the PIC. Click Open.
  • Check if the correct PIC is selected
  • Select the oscillator of choice (RC, HS, XT or LP)
  • Select code protection if needed
  • Select the appropriate fuses if need. Remember always select what you need, don’t select LVP, it’s for low voltage programming, with this programmer it will not work. If the program requires Watch dog timer, than select WDT.
  • Select Command menu –> Program All.
  • Confirm by Yes.

The green LED will light up to indicate the programmer is in programming mode. The figure below shows the complete circuit diagram of the programmer.