Showing results for 
Search instead for 
Did you mean: 

Asking about implementing and configure two interrupt timers with Hal library

M abouhasem
Associate II
Posted on July 19, 2017 at 10:14

Is it possible to manage two interrupt timers for two timer one act base timer and one worked as a counter if yes how to call different elapsed timer. Call back function

Posted on July 19, 2017 at 22:05


I Don't know what your harware is.

The callback function called automaticaly after you start the timer by call  HAL_TIM_Base_Start_IT(...)

To distinguish interrupts between different timers you can use some code like this.

HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)




             //Do something .The interrupt is from Timer 2





             //Do something else The interrupt is from Timer 3



// Don't use 'else' statement because you may lose some 'simultaneous' interrupt from another timer


Posted on July 21, 2017 at 13:16

thanks it is working 

Posted on July 21, 2017 at 17:00

M abouhasem wrote:

thanks it is working