Hi
I have a problem with 16f877a. I build a PCB for this PIC component. After programming (for example I wrote blinking LED), LED is off, but when I touch XTAL, LED turned on continuously. I change XTAL several times but outcome was the same. My XTAL is 20MHz and Caps 33pF.
That's why the XTAL's body must be soldered to GND and ofcourse the PCB's GND must be rastered.I think this method will solve your problem.
P.S. You can use oscillators insted of XTAL.They are more stabile.
1. you must use HS_OSC
2. Be sure you connect all VSS lines and all VDD line
3.as suggested, try something in between 15-33pF
4. be sure your MCLR pin is tied to VDD via resistor
5. Be sure you'd place capacitor (0.1uF) as close as possible of your PIC. For this one, i suggest 2, one on each side as you have VDD and VSS on both side of it.
As suggested, use smaller capacitors, check my tutorial hardware at which uses 12pF ones. You don't mention how you're building it?, but you need as short a leads as possible, both to the crystal and from the capacitors to 0V.
As also suggested, it's important that you select HS_OSC, which is for high speed crystals.
Your problem may be that you have not disabled LVP in the configuration fuses and you have left the PGM pin 'floating'. I've seen these symptoms described many times and easily corrected by reprogramming the PIC with the LVP option in the config' fuses turned off.