cancel
Showing results for 
Search instead for 
Did you mean: 

Timers

vijay23
Associate
Posted on August 26, 2009 at 07:03

Timers

3 REPLIES 3
vijay23
Associate
Posted on May 17, 2011 at 13:21

I am trying to use the timer output compare to generate (toggle) a high speed clock. Is this even possible? Currently, the only way I can toggle the OC's is to use interrupts. This slows down the clock speed substantially. Is it possible to toggle the OC's outside an interrupt structure?

Thank you for any suggestions.

picguy
Associate II
Posted on May 17, 2011 at 13:21

From the docs:

TIM1 & TIM8 can do PWM output. No interrupts required.

Ditto the general-purpose timers.

TIM6 & TIM7 do not have an associated output pin. However, an ISR triggered by either is free to do any output it wishes. With no software required to retrigger the timers no time keeping is lost. You may have delays in outputting the pulse but unless TIM6/7 interrupt events are lost no time will be lost.

robertwood9
Associate III
Posted on May 17, 2011 at 13:21

You can certainly create PWMs from the the timers. They are mapped to the pins with functions marked TIMx_CHy where TIM is the timer and y is the channel number.

They are rather complex beasties and you'll have to study them quite a bit to get them going if you need to understand them. With my IDE there were a load routines that just worked, including PWMs. You can always take the ST example code as a starting point and mod them if you don't mind the rather bloaty, tricky to read programming style.

[ This message was edited by: robert.wood on 26-08-2009 10:34 ]