CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC 16F877 PLCC 20Mhz oscillator not working

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alanr



Joined: 17 Jun 2004
Posts: 5

View user's profile Send private message

PIC 16F877 PLCC 20Mhz oscillator not working
PostPosted: Thu Jun 17, 2004 4:07 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jun 17, 2004 8:26 am     Reply with quote

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
PostPosted: Thu Jun 17, 2004 9:27 am     Reply with quote

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







PostPosted: Thu Jun 17, 2004 3:52 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 18, 2004 7:38 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 18, 2004 7:59 am     Reply with quote

Alen,

a sugestion,

Did you put " #fuses HS " instead of "XT"


Gerrit
alanr



Joined: 17 Jun 2004
Posts: 5

View user's profile Send private message

PostPosted: Fri Jun 18, 2004 8:20 am     Reply with quote

Gerrit,

Yup, I am using HS in the #fuses settings

Alan
Guest








Caps
PostPosted: Fri Jun 18, 2004 9:03 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 18, 2004 9:10 am     Reply with quote

Donnie,

that is what we have.

Cheers,

Alan
Chas
Guest







PostPosted: Fri Jun 18, 2004 9:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 18, 2004 9:34 am     Reply with quote

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 Very Happy

Thanks for all your help guys.

Alan
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group