cancel
Showing results for 
Search instead for 
Did you mean: 

beginner needs help understanding what Timer period and base are!

tre2020067
Associate II
Posted on September 15, 2011 at 03:08

What is a timebase and what is ?

2 REPLIES 2
Posted on September 15, 2011 at 05:54

TIM_Prescaler = N - 1; Divides the Bus/TIM clock down by N

TIM_Period = N - 1; Divide that clock down by N, ie the *period* is N ticks.

So assume your TIMCLK is ticking at 72 MHz, the *external* clock

If TIM_Prescaler = 71; the timers *internal* clock will be 1 MHz

If TIM_Period = 999; the 1MHz is divided by a 1000, so it becomes 1KHz

Your update interrupt with fire every 1ms

Now if you want to play with the channels, say in a PWM mode you can play with the output pins.

If TIM_Pulse = 500; the channel will out a frequency of 1 KHz, with a 50/50 duty cycle. ie TIM_Pulse = N / 2

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tre2020067
Associate II
Posted on September 16, 2011 at 07:55

thankyou!