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

set_timer2() Inquiry

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



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

set_timer2() Inquiry
PostPosted: Wed Mar 10, 2004 6:13 am     Reply with quote

Hi,

Any one of the community who can provide me with a mathematical calculation for set_timer2().

Say: I have setup_timer_2(T2_DIV_BY_16,100,10)

and I want to set_timer2() to a certain count value ?

Need help on this.

Thank u.
asjad



Joined: 09 Mar 2004
Posts: 52
Location: Greater Manchester - UK

View user's profile Send private message

PostPosted: Wed Mar 10, 2004 3:47 pm     Reply with quote

The calculation is as follows

(1/external crystal) *4*timer prescaler =X

suppose you insert value of 20 in tmr0 register

255-20 = 235

Now total timer 0 time = X(from above calculation) * 235

-----------------------------------------------------------------------

If you vary the value in tmr0 register you can alter the time between
interrupts
_________________
Best Regards
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: set_timer2() Inquiry
PostPosted: Wed Mar 10, 2004 5:48 pm     Reply with quote

chingB wrote:
Hi,

Any one of the community who can provide me with a mathematical calculation for set_timer2().

Say: I have setup_timer_2(T2_DIV_BY_16,100,10)

and I want to set_timer2() to a certain count value ?

Need help on this.

Thank u.


In your example
T2_DIV_BY_16 = 16 instruction cycles to increment the timer
100 = 101 timer increments to overflow
10 = 10 overflows to set the interupt flag
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