I've been reading up on the ATOMIC_BLOCK avr function and I've got a general question about interrupts and when they're active and inactive.
I've got a code which uses all 3 timer interrupts (on Atmega328P): 0 and 1 simply increment a counter at a desired frequency 2 does significantly more processing and uses the variables in interrupt 0 and 1 to access arrays
The timing of 0 and 1 are critical because they need to count at a precise frequency. The timing of 2 is less critical, but still requires to be in an interrupt as the timing of the loop() is too variable and also too slow.
My question is this: I've read that an interrupt routine disables all other interrupts at the start and reenables at the end.
Surely the time it takes to execute the code in interrupt 2 will effect the accuracy of 0 and 1 at counting at a desired frequency. In fact surely they all effect each other?!? :confused:
I am aware of the "you must keep interrupts short" argument. However even if all 3 interrupts were only 1 line of code, they'd still effect each other (because 2 is using the variables in 0 and 1).
I'd love to know if anyone has done any tests on this and has any opinions.