cancel
Showing results for 
Search instead for 
Did you mean: 

reset TIMx_CNT

Wleon.1
Associate II

Hi, does

htim4.Instance->CNT = 0 

resets the counter value in TIM4_CNT ?

Does it guarantee atomicity ?

Thanks in advance!

5 REPLIES 5
dbgarasiya
Senior II

yes sure

dbgarasiya
Senior II

but will start again timer automatically

if you have to reset timer then use

TIMx->CR1 = !(TIM_CR1_CEN); will stop timer permanently

dbgarasiya
Senior II

Best of luck

Thanks!

That code is wrong. Effectively it will translate to:

TIMx->CR1 = 0;

What was meant, is:

TIMx->CR1 &= ~TIM_CR1_CEN;