Multiple software interrupts
Posted: Sat Feb 05, 2022 10:04 pm
I am setting up two software interrupts in 1 Hz and 100 Hz as follows:
The problem is that the time of 1 Hz for LED on/off is not kept fixed. What might be wrong with the above setup? How will be the priority of two interrupts in comparison to each other?
Thanks for any help.
Code: Select all
#if defined(TIM1)
TIM_TypeDef *Instance = TIM1;
#else
TIM_TypeDef *Instance = TIM2;
#endif
HardwareTimer *MyTim = new HardwareTimer(Instance);
MyTim->setOverflow(100, HERTZ_FORMAT);
MyTim->attachInterrupt(SensorReading);
MyTim->resume();
#if defined(TIM6)
TIM_TypeDef *Instance1 = TIM6;
#else
TIM_TypeDef *Instance1 = TIM7;
#endif
HardwareTimer *MyTim1 = new HardwareTimer(Instance1);
MyTim1->setOverflow(1, HERTZ_FORMAT);
MyTim1->attachInterrupt(LED_ONOFF);
MyTim1->resume();
Thanks for any help.