View previous topic :: View next topic |
Author |
Message |
alanr
Joined: 17 Jun 2004 Posts: 5
|
PIC 16F877 PLCC 20Mhz oscillator not working |
Posted: Thu Jun 17, 2004 4:07 am |
|
|
I am using the PIC 16F877 PLCC to drive a keypad and lcd. We are trying to use a 20Mhz crystal oscillator connected to pins 14 & 15. However the ocillation is fine on the output pin but the input is not oscillating at all. We have swapped out the 20Mhz oscillator for a 12Mhz one and everything works perfectly.
Is there some setting (other than the #use delay(clock=20000000) ) that is required in either my CCS C program or the MPLAB programmer to use a 20Mhz oscillator?
Thanks
Alan |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Jun 17, 2004 8:26 am |
|
|
As I interpret what you say, when you put a scope probe on the oscillator output you get a good oscillation. But when you put the scope probe on the input you see nothing.
This is not at all suprising. The scope probe probably has like 10 pF of capacitance and 10 Meg of resistance. That is a lot for a crystal. The scope probe may be loading the crystal so much that the oscillation stops. When you probe the output the probe capacitance is driven by the oscilator driver which is better at driving loads. Even probing the output of the oscillator may cause a frequency and amplitude shift though.
If you really want to check the crystal frequency accurately program the chip to generate a square wave with a timer and measure the output of the timer. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Ttelmah Guest
|
Re: PIC 16F877 PLCC 20Mhz oscillator not working |
Posted: Thu Jun 17, 2004 9:27 am |
|
|
alanr wrote: | I am using the PIC 16F877 PLCC to drive a keypad and lcd. We are trying to use a 20Mhz crystal oscillator connected to pins 14 & 15. However the ocillation is fine on the output pin but the input is not oscillating at all. We have swapped out the 20Mhz oscillator for a 12Mhz one and everything works perfectly.
Is there some setting (other than the #use delay(clock=20000000) ) that is required in either my CCS C program or the MPLAB programmer to use a 20Mhz oscillator?
Thanks
Alan |
Remember you need 'HS' in the fuses to increase the oscillator gain. Otherwise, the most likely thing (as SherpaDoug says) is just that the probe is loading the input too much. You would not see oscillation on the output pin, unless the oscillator was running.
Best Wishes |
|
|
Mike picking away Guest
|
|
Posted: Thu Jun 17, 2004 3:52 pm |
|
|
Do you have an inline resistor value of about 300 ohm to help with overloading the oscilator? at 4-12 Mhz this may not be needed, but at 20Mhz it is a must. |
|
|
alanr
Joined: 17 Jun 2004 Posts: 5
|
|
Posted: Fri Jun 18, 2004 7:38 am |
|
|
OK, we tried the inline resistor, this didn't work, I'm not sure that the scope probe theory is the problem either, we use the same 20Mhz oscillator circuit with an 18F452 and can use the scope on input and output fine.
My program works fine on the 12Mhz oscillator, as I can display text on the LCD and flash some LEDs etc. When the same circuit contains the 20Mhz oscillator the only code change I've made is in the "#use delay" statement to change from 12Mhz to 20Mhz but nothing is running on the chip as the oscillator does not seem to be working correctly. We have tried differnt values of capacitor with the oscillator also but to no effect.
Alan |
|
|
Gerrit
Joined: 15 Sep 2003 Posts: 58
|
|
Posted: Fri Jun 18, 2004 7:59 am |
|
|
Alen,
a sugestion,
Did you put " #fuses HS " instead of "XT"
Gerrit |
|
|
alanr
Joined: 17 Jun 2004 Posts: 5
|
|
Posted: Fri Jun 18, 2004 8:20 am |
|
|
Gerrit,
Yup, I am using HS in the #fuses settings
Alan |
|
|
Guest
|
Caps |
Posted: Fri Jun 18, 2004 9:03 am |
|
|
Try adding a 22pf to the crystal leads to ground.
to pic to pic
! !
! !
----{XTAL}-----
! !
---- ----
CAP CAP
---- ----
! !
----- ------
--- ---
- -
Caps are usually 22-33pf
Donnie |
|
|
alanr
Joined: 17 Jun 2004 Posts: 5
|
|
Posted: Fri Jun 18, 2004 9:10 am |
|
|
Donnie,
that is what we have.
Cheers,
Alan |
|
|
Chas Guest
|
|
Posted: Fri Jun 18, 2004 9:15 am |
|
|
Are you certain that the parts you are using are qualified for 20MHz operation? The 877 comes in 3 speed grades, 4MHz, 10MHz, and 20MHz. |
|
|
alanr
Joined: 17 Jun 2004 Posts: 5
|
|
Posted: Fri Jun 18, 2004 9:34 am |
|
|
Bingo! just checked the part we are using and it is the 4Mhz version, doh. I'd just like to qualify that I didn't build the circuit and I am a software engineer not electronics
Thanks for all your help guys.
Alan |
|
|
|