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 support@ccsinfo.com

frequency problem

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



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

frequency problem
PostPosted: Thu May 03, 2007 10:39 am     Reply with quote

I use
setup_timer_2(T2_DIV_BY_1 , 255, 1);
and 4 MHZ crystal put the frequency is 30 hz and not 4KHZ which is the right frequence.I use PCM compiler and pic16F777.

What is the problem?????
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 03, 2007 11:00 am     Reply with quote

Do some detective work. Study the ratios of the numbers.

It's running at 30 Hz, but you believe it should be 4000 Hz.
What is the ratio of these frequencies ? It's this:
Code:

 30
---- = .0075
4000 


Now multiply that ratio by the oscillator frequency that you believe
the PIC is running at:
Code:
.0075 * 4000000 = 30000


This implies that the true oscillator frequency is about 30 KHz.

Now look in the PIC data sheet, in oscillator section. Is there a
setting for the internal oscillator that is approximately 30 KHz ?
If so, your PIC is probably configured for that setting. How can
you change it to the desired setting of 4 MHz ? These are the
questions that you must answer.
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