External Input Counter and External interrupt

External Input Counter and External interrupt : count the input signal from the button. 

So what is the different between two methods ?

While external interrupt needs to jump into the interrupt routine to do the increment or decrement of a variable,

counter can handle the job nicely without jumping anywhere with External Input Counter.

Therefore, it will be obviously useful when your program has many types of interrupt running. 

HAL_TIM_Base_Start(&htim2);    //Start TIM2 without interrupt

while (1)
{
  count = __HAL_TIM_GetCounter(&htim2);    //read TIM2 counter value
}

 

posted @ 2015-08-26 21:59  IAmAProgrammer  阅读(510)  评论(0编辑  收藏  举报