cancel
Showing results for 
Search instead for 
Did you mean: 

TIMER std peripheral lib

ybitton
Associate II
Posted on April 05, 2011 at 13:47

Hi,

While using standart peripheral

tim

library, i have noticed  that the folloeing OC modes are avilable:

  1. TIM_OCMode_Timing.
  2. TIM_OCMode_Active.
  3. TIM_OCMode_Inactive.
  4. TIM_OCMode_Toggle.
  5. TIM_OCMode_PWM1.
  6. TIM_OCMode_PWM2.

Can anyone describe each mode?

what is the difference between them (for example between 1 & 3)?

(I read the chip refrence manual timer section but couldn't figure all modes).

Thanks - Udi.

 

#stm32-timer
1 REPLY 1
Posted on April 05, 2011 at 21:32

I think the reference manual does go into some detail, you can correlate the defined values against the register settings, and the block diagrams of the timers.

The Timing mode (1) doesn't do ANYTHING with the output pins, it's for interrupt tickers. Whereas Inactive mode (3) the OC1REF is driven to ZERO on a match, or Active (2) the OC1REF is driven to ONE on a match, basically describes a one-shot pulse. The difference between PWM1 and PWM2 is whether you are controlling the ON or OFF periods, a repetitive pulse. The toggle mode flips the state of OC1REF at each match, a clock divider (50/50 duty). There are several modes which don't have library defines, and these drive OC1REF to ZERO or ONE all the time, regardless of any comparisons.

The usefulness of any of these modes will depend on your application.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..