Skip to main content
Killstreet30
Associate III
March 27, 2023
Solved

Doubt regarding timer interrupt stop function

  • March 27, 2023
  • 1 reply
  • 947 views

Hi,

I had a doubt regarding the timer interrupt stop function.

if(isOpen_Unload == 1){

 HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);

 HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);

 Start_Motor(1);

 HAL_Delay(5000);

 HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

 HAL_TIM_Base_Start_IT(&htim3);

 time_up = 0;

 close_tray_unloading();

 }

void close_tray_unloading(){

 curr = 0;

 while(!time_up){

  curr = final_load();

  if(curr < initial_weight){

   HAL_TIM_Base_Stop_IT(&htim3);

   if(isClose_Unload == 1){

       isClose = 1;

      }

   break;

  }

 }

}

Now in the above code as you can see I have started the timer interrupt after motor starts running and it is set to 15 secs. But I want to stop the timer interrupt when my current weight < initial weight as you can see in the condition but even though my current weight < initial weight it never stops the timer and timer interrupt gets completed. Have tried debugging using breakpoints but it never reaches HAL_TIM_base stop when though current weight is less than initial weight. Please help.

This topic has been closed for replies.
Best answer by Killstreet30

It's solved Thank you.

1 reply

Killstreet30
Killstreet30AuthorBest answer
Associate III
March 27, 2023

It's solved Thank you.