cancel
Showing results for 
Search instead for 
Did you mean: 

TIM 1 to generate a clock of a specific number of pulses.

romybompart
Associate II
Posted on March 05, 2014 at 15:52

Hi guys. 

I know some of you guys have done something like this. I would like to implement the TIM1 to generate a clock, using it as a PWM out-up mode, but I wish ( if it is possible) modify its functioning to generate a certain quantity of pulses depending of a trigger by software.

For example I would like to write in some register (I don't know which one yet) a number, to generate 10 OCx Pulses. At this moment I have to disable the PRELOAD REGISTER and COUNTER.

Has anyone done something like this?

#clock #pulses #tim1
1 REPLY 1
Posted on March 05, 2014 at 21:24

You should be able to program the repetition counter (TIMx_RCR - TIM_TimeBaseInitStruct->TIM_RepetitionCounter), alternatively you can use DMA to provide a table of sequences to be feed to the TIM peripheral.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..