@GiorgioCapocasa Take a look at the code on the website there is a line in system.c "timer1.attach(&ISR_timer1, 0.001)" to set the timer to 1ms.
The idea behind this is that you want to write routines that are fast and return quickly. If there is a long routine such as communication I would use a state machine to break it up, and use UART hardware, etc
Yes, if the routine takes more than 1ms it will block other processing. 1ms is pretty fast, I use the 100ms flag and keep the routines small.
Thank you for this video, but I've got a few questions :S
How did you get the ISR to run once every millisecond?
What if my 1msRoutine takes more than 1millisecond? Will the rest of the code be delayed?
I'm sorry, I'm quite new to microcontrollers.
GiorgioCapocasa 3 months ago
@GiorgioCapocasa Take a look at the code on the website there is a line in system.c "timer1.attach(&ISR_timer1, 0.001)" to set the timer to 1ms.
The idea behind this is that you want to write routines that are fast and return quickly. If there is a long routine such as communication I would use a state machine to break it up, and use UART hardware, etc
Yes, if the routine takes more than 1ms it will block other processing. 1ms is pretty fast, I use the 100ms flag and keep the routines small.
s1axter 3 months ago