People often have problems with their homemade programmers. In most cases, this is not a problem of the programmer Software, but a problem of the programmer hardware or the connection to the PIC microcontroller.
Here I want to provide some hints, tipps and tricks which can be used for troubleshooting such problems.
All Vdd and Vss pins of the PIC have to be connected to the corresponding power supply pins. Also the analog power supply pins AVdd and AVss (if available) have to be connected to the power supply.
Each Vdd pin shall be connected to a decoupling capacitor, i.e. a capacitor between Vdd and ground. The capacitor shall be placed as close as possible to the Vdd pin. A typical value for a decoupling capacitor is 100nF.
For Low-Voltage programmers, make sure that the PGM pin of the PIC is tied to ground via a pull-down resistor (~10k).
For High-Voltage programming, it also might be necessary to connect the PGM pin to GND. So if programming fails, try to connect the PGM pin to ground via a 10k resistor.
PICs which can be programmed either in High-Voltage or Low-Voltage mode may make problems during programming in High-Voltage mode if the LVP bit (Low Voltage ICSP Enable bit) in the configuration memory is enabled. Please note that if you program a PIC the first time, the LVP bit (Low Voltage ICSP Enable bit) in configuration memory is set, i.e. LVP enabled.
The same problem could also occur if the MCLR pin is used as I/O pin.
Here's what the programming specification says:
"If the LVP fuse is enabled, PGM should be held low to prevent inadvertent entry into LVP mode."
If you are using a High-Voltage programmer, make sure that the programming voltage on MCLR pin is within the voltage thresholds specified in the programming specification of the PIC to be programmed.
The voltage thresholds for each PIC can be found here.
PGD and PGC filtering:
Put 22..47 pF capacitor on the PGD (data) and PGC (clock) lines to ground near the target chip. In addition, put a 100 ohm resistor in series with the PGD line between target chip and the cap. The resistor and capacitor on the PGD line low pass filter the PGD signal when it is driven by the target chip. This reduces the high frequencies that can couple onto the PGC line. The cap on the PGC line makes it less suceptible to coupled noise.
If you are using a PIC where MCLR pin is configured as I/O pin via configuration bits and the PIC cannot be programmed nor detected, try the following procedure:
1) Remove the PIC from the programmer
2) Click the autodetect programmer button in PICPgm
3) Insert the PIC in the programmer
4) Try programming
If you are using PICPgm LVISP Programmer, please make sure that the 74LS05 chip on the programmer is connected to the +5V power supply, i.e. pin 14 = +5V and pin 7 = GND.
If you are using a programmer connected to LTP, please make sure that you have administrator rights, otherwise it is not possible for PICPgm to access the LPT port.
Under Windows Vista you have to run PICPgm with administrator permissions. To do that, just right click on the PICPgm icon and the drop down menu select "Run As Administrator".