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

Need help generating frequencies

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







Need help generating frequencies
PostPosted: Wed Feb 04, 2009 6:08 pm     Reply with quote

HI,
I am using a 24HJ128GP306 PIC. I want to generate frequencies between 100 hz and 1.6khz. I am using the output compare function, but the only freq I get is either very low or 58 hz, regardless of what variables I change. Is there something I am missing ?

Here is the snippet of code I am using:
Code:

setup_timer2( TMR_INTERNAL|tmr_div_by_8);
set_compare_time(1, 50000);
setup_compare(1, compare_toggel | COMPARE_TIMER2);

do
{
output_toggle(pin_b4);
delay_ms(250);
}while(1);

The only thing that changes the frequency is the tmr div by.
Is there a problem with me or the 16/24 bit compiler ?

Thanks in advance
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