PDA

View Full Version : 20MHz crystal



markdem
- 23rd June 2005, 12:04
Hi All. I am trying to build a very simple device with a PIC16F877A, but i can make the 20MHz crystal start. After about 2 hours of playing with it, i can make it work by touching the OCS2 pin with my hand. It will not work if i ground it. I can touch it before or after the crystal. It is almost like i am adding to the storage of the caps. I have tried all cap values from 10pf to 33pf, but it does not help. I have surched this forum and the web, but can not work this one out.
I have set the HS fuse, have tried new crystals, caps etc and have put a 1M risistor across the osc1 and osc2 pins. What else can i try??
Thank you for your help

Mark

markdem
- 23rd June 2005, 13:45
Just to add to the problem, i have now tried a 4MHz resonator, and changed my code to reflect (XT and speed) but i still have the same problem. Any ideas??

Thanks, Mark

Melanie
- 23rd June 2005, 14:26
Hmmm... you got your MCLR pin floating?

ensure... You have pin 1 (MCLR) connected to +5v
ensure you have +5v on the Vdd pin
ensure you have BOTH Vss pins connected to 0v

Burn-in a blink LED program (with the LED on a PortB pin so as not to worry about internal ADC's and comparators) to test your PIC is alive.

Last of all, try another PIC.

Dwayne
- 23rd June 2005, 17:35
I think Mel's hit it right on the head....

The MClR pin.....


Make sure you are not programming your chip with the MCLR pin as a reset. Make it a "input"... and/or tie it to 5 volts.

Dwayne


PS: One other thing... If you don't use switches to toggle the flags on your programmer, the MCLR seems to default to "reset"... Thus you changing it to "input pin" will be nullified when you attempt to program your chip a second time. I have been caught with my pants down a few times on this <g>... This I use Switches in my program now, for setting the Melabs programmer to the proper configuration.

mister_e
- 24th June 2005, 03:58
Can also be a damn breadboard loose or faulty contact.

What about if you remove both capacitor around the crystal???

markdem
- 24th June 2005, 13:26
Hi all, thank you so much for helping me. I dont know what i am doing wrong. I have now got a new PIC (PIC16F84A) and it will stilll do the same thing. I have checked the connections, and all are OK. I have tried to remove the charge caps, but it does not help. I have checked the MCLR, and it does have +5 on it. The only way i can make anything work here is by touching OSC1 with my bare hand, like i am giving it ground or somting. Sorry, i am not too good at this, and still only learning. What else can i try?

Thank you

Mark

badrad
- 24th June 2005, 15:08
can you take a picture of your circuit. that might help us see what you have wired up.

Luciano
- 24th June 2005, 15:13
Hi,

- Post the model number of the crystal and URL to its PDF datasheet.
- Post the schematic of your board.
- Post the PicBasic code.
- Post JPG pictures of both sides of the board. (Close-up near the crystal).

If you don't have a digital camera use a CCD flatbed scanner.
(Small files < 100K).

Best regards,

Luciano

Dwayne
- 24th June 2005, 15:39
Hello Mark,

Mark>>I have set the HS fuse<<

Mark, I know I sound like a broken Record, but I think Melanie has hit it on the head. Your ability to "turn on" the circuit by touching, is a extremely good sign of a floating MCLR pin. Also improper grounding and sourcing.

Have you set the MCLR fuse to "input", every time you programmed your chip? I have not checked the DataSheet, but if your chip as a internal Clock, try it with the internal clock.

And like Melanie said... Make SURE your grounds are grounded and your sources are to 5 volts!.

Dwayne