Skip to main content
added 1 character in body
Source Link
JRE
  • 75.1k
  • 10
  • 115
  • 197

I was building a simple Blinkblink application on an STM8S, the. The LED on-off interval was controlled by Delaythe delay function using the TIM4 Interruptinterrupt. A button event monitor is using another external Interruptinterrupt to prevent the interference from the Timer Interrupttimer interrupt.

But I also found out that even the button event is not interrupted by the Delaydelay function, but the Functionfunction associated with it still gets interrupted by the Delaydelay function, it. It will only execute after delay() returns no matter how early I press the button.

Is there a way to bypass this? Should I enable another TIMERtimer (like TIM2) to independently handle the button event? I need some insights.

The Buttonbutton is controlled by relatedthe code here:

INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ //if the Button is pressed if(mode == 2) { mode = 0; } else { mode ++; } } 

main.c

void main(void) { CLK_Config(); GPIO_Config(); TIM4_Config(); /* Infinite loop */ while (1) { Switch_Blink_Pattern(mode); } } 

Delay FunctionThe delay function is from STM's demo, using TIM4:

 INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ TimingDelay_Decrement(); /* Cleat Interrupt Pending bit */ TIM4_ClearITPendingBit(TIM4_IT_UPDATE); } void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while (TimingDelay != 0); } void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } 

I was building a simple Blink application on STM8S, the LED on-off interval was controlled by Delay function using TIM4 Interrupt. A button event monitor is using another external Interrupt to prevent the interference from the Timer Interrupt.

But I also found out that even the button event is not interrupted by the Delay function, but the Function associated with it still gets interrupted by the Delay function, it will only execute after delay() returns no matter how early I press the button.

Is there a way to bypass this? Should I enable another TIMER(like TIM2) to independently handle the button event? I need some insights.

The Button is controlled by related code here:

INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ //if the Button is pressed if(mode == 2) { mode = 0; } else { mode ++; } } 

main.c

void main(void) { CLK_Config(); GPIO_Config(); TIM4_Config(); /* Infinite loop */ while (1) { Switch_Blink_Pattern(mode); } } 

Delay Function is from STM's demo, using TIM4

 INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ TimingDelay_Decrement(); /* Cleat Interrupt Pending bit */ TIM4_ClearITPendingBit(TIM4_IT_UPDATE); } void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while (TimingDelay != 0); } void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } 

I was building a simple blink application on an STM8S. The LED on-off interval was controlled by the delay function using the TIM4 interrupt. A button event monitor is using another external interrupt to prevent interference from the timer interrupt.

I found that the button event is not interrupted by the delay function, but the function associated with it still gets interrupted by the delay function. It will only execute after delay() returns no matter how early I press the button.

Is there a way to bypass this? Should I enable another timer (like TIM2) to independently handle the button event? I need some insights.

The button is controlled by the code here:

INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ //if the Button is pressed if(mode == 2) { mode = 0; } else { mode ++; } } 

main.c

void main(void) { CLK_Config(); GPIO_Config(); TIM4_Config(); /* Infinite loop */ while (1) { Switch_Blink_Pattern(mode); } } 

The delay function is from STM's demo, using TIM4:

 INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ TimingDelay_Decrement(); /* Cleat Interrupt Pending bit */ TIM4_ClearITPendingBit(TIM4_IT_UPDATE); } void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while (TimingDelay != 0); } void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } 
added related codes
Source Link

I was building a simple blinkBlink application on an STM8S. The, the LED on-off interval was controlled by the delayDelay function using the TIM4 interruptInterrupt. A button event monitor is using another external interruptInterrupt to prevent the interference from the timer interruptTimer Interrupt.

But I also found out that even the button event is not interrupted by the delayDelay function, but the functionFunction associated with it still gets interrupted by the delayDelay function. It, it will only execute after delay() returns, no matter how early I press the button.

Is there a way to bypass this? Should I enable another timer TIMER(like TIM2) to independently handle the button event? I need some insights.

The Button is controlled by related code here:

INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ //if the Button is pressed if(mode == 2) { mode = 0; } else { mode ++; } } 

main.c

void main(void) { CLK_Config(); GPIO_Config(); TIM4_Config(); /* Infinite loop */ while (1) { Switch_Blink_Pattern(mode); } } 

Delay Function is from STM's demo, using TIM4

 INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ TimingDelay_Decrement(); /* Cleat Interrupt Pending bit */ TIM4_ClearITPendingBit(TIM4_IT_UPDATE); } void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while (TimingDelay != 0); } void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } 

I was building a simple blink application on an STM8S. The LED on-off interval was controlled by the delay function using the TIM4 interrupt. A button event monitor is using another external interrupt to prevent the interference from the timer interrupt.

I found that even the button event is not interrupted by the delay function, but the function associated with it still gets interrupted by the delay function. It will only execute after delay() returns, no matter how early I press the button.

Is there a way to bypass this? Should I enable another timer (like TIM2) to independently handle the button event? I need some insights.

I was building a simple Blink application on STM8S, the LED on-off interval was controlled by Delay function using TIM4 Interrupt. A button event monitor is using another external Interrupt to prevent the interference from the Timer Interrupt.

But I also found out that even the button event is not interrupted by the Delay function, but the Function associated with it still gets interrupted by the Delay function, it will only execute after delay() returns no matter how early I press the button.

Is there a way to bypass this? Should I enable another TIMER(like TIM2) to independently handle the button event? I need some insights.

The Button is controlled by related code here:

INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ //if the Button is pressed if(mode == 2) { mode = 0; } else { mode ++; } } 

main.c

void main(void) { CLK_Config(); GPIO_Config(); TIM4_Config(); /* Infinite loop */ while (1) { Switch_Blink_Pattern(mode); } } 

Delay Function is from STM's demo, using TIM4

 INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) { /* In order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction. */ TimingDelay_Decrement(); /* Cleat Interrupt Pending bit */ TIM4_ClearITPendingBit(TIM4_IT_UPDATE); } void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while (TimingDelay != 0); } void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } 
edited body; edited title
Source Link
JRE
  • 75.1k
  • 10
  • 115
  • 197

STM8S how: How to avoidkeep my functions interruptfrom being interrupted by the delay function?

I was building a simple Blinkblink application on an STM8S, the. The LED on-off interval was controlled by Delaythe delay function using the TIM4 Interruptinterrupt. A button event monitor is using another external Interruptinterrupt to prevent the interference from the Timer Interrupttimer interrupt.

But I also found out that even the button event is not interrupted by the Delaydelay function, but the Functionfunction associated with it still gets interrupted by the Delaydelay function, it. It will only execute after delay() returns, no matter how early I press the button.

Is there a way to bypass this? Should I enable another TIMERtimer (like TIM2) to independently handle the button event? I need some insights.

STM8S how to avoid my functions interrupt by delay function

I was building a simple Blink application on STM8S, the LED on-off interval was controlled by Delay function using TIM4 Interrupt. A button event monitor is using another external Interrupt to prevent the interference from the Timer Interrupt.

But I also found out that even the button event is not interrupted by the Delay function, but the Function associated with it still gets interrupted by the Delay function, it will only execute after delay() returns no matter how early I press the button.

Is there a way to bypass this? Should I enable another TIMER(like TIM2) to independently handle the button event? I need some insights.

STM8S: How to keep my functions from being interrupted by the delay function?

I was building a simple blink application on an STM8S. The LED on-off interval was controlled by the delay function using the TIM4 interrupt. A button event monitor is using another external interrupt to prevent the interference from the timer interrupt.

I found that even the button event is not interrupted by the delay function, but the function associated with it still gets interrupted by the delay function. It will only execute after delay() returns, no matter how early I press the button.

Is there a way to bypass this? Should I enable another timer (like TIM2) to independently handle the button event? I need some insights.

Source Link
Loading