cancel
Showing results for 
Search instead for 
Did you mean: 

How can I count TIM1 overflow when TIM1 was external clock mode 1

hdemi.1
Associate III

Hi I am the new for stm32

I use perih. library for stm32f0. Could you show using register not hal library

My code is like below

void TIM1_BRK_UP_TRG_COM_IRQHandler(){

if(TIM_GetITStatus(TIM1,TIM_IT_Trigger) != RESET){

if((TIM1->CR1 &TIM_CR1_URS )== RESET ){

tut++ ;}

}

 TIM_ClearITPendingBit(TIM1, TIM_IT_Trigger);

}

1 REPLY 1

> TIM_IT_Trigger

No. Overflow causes the Update signal, so you want to use TIM_IT_Update at both places.

> if((TIM1->CR1 &TIM_CR1_URS )== RESET ){

There is no reason for this check.

JW