millis() interrupt effect

I never thought of it before but timer0 interrupt actually interrupts the loop every millisecond to make the millis() calculation correct?

I never noticed discussion of the effects of this before. Now I am curious, when using a stop all interrupts command in order to do something, or when using an ISR that may be lengthy is it true that millis() stops incrementing and possibly is inaccurate?

Yes, absolutely - you need to miss TWO counts of the interrupt though, not just one (with just one missed, as soon as interrupts come back on, the interrupt flag will be noticed so the timer ISR will fire).

If you have interrupts off for that long though, you're probably doing something wrong, and if you have an ISR that takes that long to run, you're definitely doing something wrong.

Yes that is true. You'll also find if you time your loop and print the timing out every time it will often vary by more than you think it should. What you're measuring is that sometimes your loop is getting interrupted and sometimes it isn't so sometimes it takes longer to get through.

Ok, so the timers are not stopped by interrupts correct?

If there are multiple ISRs triggered by multiple timers quickly before they all complete are they all run in order as soon as the processor is available? I imagine if an ISR is triggered multiple times before it can be run it is only run once when the processor is available?

perigalacticon:
Ok, so the timers are not stopped by interrupts correct?

If there are multiple ISRs triggered by multiple timers quickly before they all complete are they all run in order as soon as the processor is available?

They’re run in order of priority. The processor doesn’t know anything about which one actually fired first.

perigalacticon:
I imagine if an ISR is triggered multiple times before it can be run it is only run once when the processor is available?

That is correct. One of the big reasons ISR code has to be kept short short short.

Thanks I have tried to do some audio processing that is lengthy because of retrieving the stored data and processing it but requires good timing.