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

timers - starting and stopping

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



Joined: 24 May 2006
Posts: 14

View user's profile Send private message

timers - starting and stopping
PostPosted: Sat Mar 07, 2009 10:17 pm     Reply with quote

How do you start a timer after its already been stopped ?

timer1 is turned on through initial setup_timer1()
timer1 is stopped using setup_timer1() function
but how do you get timer1 to turn back on. Set it up again ? Is there a bit I can turn on ?
efox



Joined: 24 May 2006
Posts: 14

View user's profile Send private message

PostPosted: Sat Mar 07, 2009 10:32 pm     Reply with quote

probably found my own indirect answer for this...

but if you want to turn a timer back on
setup_timer_1(!T1_DISABLED)

Though if there is another way or explanation, love to hear it.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 07, 2009 10:55 pm     Reply with quote

Quote:
but if you want to turn a timer back on
setup_timer_1(!T1_DISABLED)

You shouldn't make an assumption like that. The values that can be
used for parameters for the Timer functions are listed in the .H file
for your PIC. Don't use anything else. For example, in 16F877.h
these two constants should be used to disable and enable Timer1:
Code:

#define T1_DISABLED         0
#define T1_INTERNAL         0x85

When you enable it, you also have the option to OR it with a clock divisor
value, as given in the .h file.
Guest








PostPosted: Sun Mar 08, 2009 1:09 am     Reply with quote

ya im noticing a lot of errors in my 'logic'

CCS is really good with its functions and optimization, but i find the headers a bit confusing.

maybe because im coming from C18.

thank you for your help though.
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