cancel
Showing results for 
Search instead for 
Did you mean: 

Timer -> generate number of pulses

tg.developer
Associate II
Posted on July 07, 2015 at 07:04

Hello,

I would like to generate number of pulses on timer3. I am using two channels PB6&PB7

which runs at different period, but on same timer.  For that reason I am using OC1&OC2 and I am counting number of pulses at each channel at interrupt service routine. 

The problem is,that I do not know how to disable interrupt on single channel, since it

happens, that both interrupts stops.

Could you point me to some example how to stop single only OCx interrupt?

#stm32f103
1 REPLY 1
Posted on July 07, 2015 at 17:59

In the SPL you'd

  /* Disable the CC1 Interrupt Request */

  TIM_ITConfig(TIM3, TIM_IT_CC1, DISABLE);

  /* Disable the CC2 Interrupt Request */

  TIM_ITConfig(TIM3, TIM_IT_CC2, DISABLE);

And flag to yourself not to check the IT bits for these in the IRQ Handler. Note the Enable/Disable gates the IT bits to the NVIC, they still assert in the status register whether they are enabled or not.

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