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

How to use timers

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



Joined: 17 Sep 2011
Posts: 2

View user's profile Send private message

How to use timers
PostPosted: Tue Oct 18, 2011 9:36 pm     Reply with quote

Well this is the first time I wanna use them. The thing is that I wanna do something every hour in the pic...so every hour it has to stop and do another thing for instance light on a led and then do that again one hour after. Is there a way to do it using timers or do I have to use a counter or something like that ?
Thank you so much for the help! (And btw my english is not that good so I hope I made my point ;)
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Wed Oct 19, 2011 8:37 am     Reply with quote

hi,

Look at the compiler help section, search for set up timer
or search here in the forum how to set up a timer.

No timer will *time* for an hour... thats too long. However
you can set up a time for 0.5 Seconds (for example).

And then count how many times it overflows. When it overflows 7200(3600 seconds) times... an hour has passed.

You can set the PIC to sleep in between timer overflows and save power!

Hope that helps.

G
_________________
CCS PCM 5.078 & CCS PCH 5.093
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 19, 2011 2:37 pm     Reply with quote

This post has links to several tutorials. At least 4 of them are about
PIC timers:
http://www.ccsinfo.com/forum/viewtopic.php?t=46384&start=3

This thread shows how to use a timer to make a delay of several seconds:
http://www.ccsinfo.com/forum/viewtopic.php?t=46125

This thread shows how to put the PIC to sleep for several seconds, with
Timer1 using an external 32.768 KHz Watch crystal (and capacitors).
http://www.ccsinfo.com/forum/viewtopic.php?t=45458
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