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 CCS Technical Support

setup_timer_2( )

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



Joined: 15 Feb 2012
Posts: 11

View user's profile Send private message

setup_timer_2( )
PostPosted: Fri Feb 17, 2012 10:33 am     Reply with quote

Who can explain ?


Quote:
setup_timer_2 ( T2_DIV_BY_4, 0xc0, 2);

// At 20Mhz, the timer will increment every 800ns,

// will overflow every 154.4us,

// and will interrupt every 308.8us.


1. How to get the value of 800ns, 154.4us, and 308.8us ?
2. 20MHz oscillator means what? What is the use to have oscillator?
Lemosek



Joined: 15 Oct 2011
Posts: 36

View user's profile Send private message

PostPosted: Fri Feb 17, 2012 11:46 am     Reply with quote

Hello,
At this link:
http://www.ccsinfo.com/forum/viewtopic.php?t=44557&highlight=timer2
Mr. Ttelmah explain how to set timer2.

Best regards
R.L.
samuel yap



Joined: 15 Feb 2012
Posts: 11

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 1:05 am     Reply with quote

He only explain about 154.4us, what about 800ns and 308.8us ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 6:01 am     Reply with quote

Look again.
Think for a moment. Master clock/(4*prescaler), gives a clock rate of 1.25MHz feeding the counter. What is 1/1.25E6?
Then what is 154.4*2. Given the last number says 'how many times the timer must loop between interrupts', what do you think this implies?....

Best Wishes
samuel yap



Joined: 15 Feb 2012
Posts: 11

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 7:31 am     Reply with quote

Ttelmah wrote:
Look again.
Think for a moment. Master clock/(4*prescaler), gives a clock rate of 1.25MHz feeding the counter. What is 1/1.25E6?
Then what is 154.4*2. Given the last number says 'how many times the timer must loop between interrupts', what do you think this implies?....

Best Wishes


thx, very clear. may i know what is mean by overflow ?
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