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

wanna create frequency

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



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

wanna create frequency
PostPosted: Wed Sep 26, 2007 12:14 am     Reply with quote

Hi everyone,
i want to create a frequency that starts from 100hz and ends at 5hz when i press a pushbutton.the duration between start and end is 30 sec.i am using pic16f84a and want to use timer0 for this purpose.i am using ccs compiler version 4.020
i have no idea about using timers and interrupts.
can anyone give me a proper guidence from where i start.
have anyone any example.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Wed Sep 26, 2007 5:17 pm     Reply with quote

A lot of example code come with CCS compiler. The files are installed into C:\Program Files\PICC\Examples directory. The descriptions of the examples are here – http://www.ccsinfo.com/devices.php?page=exlist

To start using timer, you should, probably look at the EX_STWT.C example.
_________________
Read the label, before opening a can of worms.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Wed Sep 26, 2007 10:40 pm     Reply with quote

Thanks kender.
i have already saw the examples but i am still confused Confused
how to use timer and interupts.can anyone have easy way/method from which i can understand.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Sep 27, 2007 7:48 am     Reply with quote

I would create a "numerically controlled oscillator" for this. Since you just want a square wave output you don't need any waveform lookup table. You just need to add another register for the delta frequency per computation cycle.

A few years ago I wrote one for a 16C58 running at 20MHz that synthesized a sonar burst between 24kHz and 32kHz, so working below 100Hz should be easy.
_________________
The search for better is endless. Instead simply find very good and get the job done.
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