Step 8: Electronic Check & Programming the PIC
Then fire up your PC, launch Microchip IDE and program the PIC microcontroller on the PCB with the HEX file provided. You need to connect a 5V power supply. I use a straight 5 pin header to connect (square pad marks the MCLR pin) the programmer. Mine is ICD 2, but any compatible programmer such as ICD 3, PICKit 2 and 3 should work.
Just use the PCB holes/pads as though they are the female connector. Give a bit of tension sideways to make sure the electrical connection is stable.
You need to use "high-voltage programming" mode. IDE defaults to low-voltage programming mode for the device, so make sure to change the mode. You will find this option in IDE, under "Programmer" menu -> "Settings". On "Program Memory" tab, check "Use high voltage on MCLR".
(If your programmer is an older one like mine, you also need to make sure that the programming voltage for high voltage programming mode is below 9V. Microchip suggest using high-speed shunt regulator on MCLR pin to clip the voltage - I found this overkill - I just put a 8.2 V zener diode between MCLR and GND. It works!
If you get the following:
"The following memory regions failed to program correctly:
Address: 00f8000c Expected Value: 0000007a Received Value: 000000fa
then you are not using high-voltage programming mode. Please double check the setting (see the screen shot) and try again.
If all is well, you'll see the IDE reporting successful programming. If not, go back to more inspection.