View previous topic :: View next topic |
Author |
Message |
samuel yap
Joined: 15 Feb 2012 Posts: 11
|
setup_timer_2( ) |
Posted: Fri Feb 17, 2012 10:33 am |
|
|
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
|
|
|
samuel yap
Joined: 15 Feb 2012 Posts: 11
|
|
Posted: Mon Feb 20, 2012 1:05 am |
|
|
He only explain about 154.4us, what about 800ns and 308.8us ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Mon Feb 20, 2012 6:01 am |
|
|
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
|
|
Posted: Mon Feb 20, 2012 7:31 am |
|
|
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 ? |
|
|
|