Possible side effects from disabling Timer 0 Overflow Interrupt?

Hi there!

Could someone please elaborate on the side effects of disabling Timer 0 overflow interrupt, like:




The reason is that T0 overflow interrupt is not playing nice with V-USB ONLY when using it on my PS3 (it works flawlessly on PCs and Macs): PS3 keeps reseting the USB port several times until it finally recognizes the USB device being emulated by the Arduino.

I've disabled that interrups and everything seems to be working properly, but I really would like to know if there's any hidden side effect from doing that!



The Timer 0 overflow interrupt is used by millis() and micros() to keep track of elapsed time. If you don't care about that, it won't matter. (That is, the values won't increment any more if you disable the overflow interrupt).

(edit) The figure returned from micros() will change a bit because it adds in the current timer amount, but it won't change a large amount.


I think I should care about it because I make use of delay() (which calls micros()) and millis() functions a lot.

The Arduino is playing as an USB adapter for classic controllers (NES, SNES, N64, GC, PS2, Sega Genesis...) and in order to correctly read controller data, I really have to rely on timing functions.

And the weird part is that everything seems to be working fine with that interrupt disabled!!!

Does that interrupt affect millis() function? I'm asking because I can see a reference to "timer0_overflow_count" only inside micros() function...

Thanks for the quick reply!


    // copy these to local variables so they can be stored in registers
    // (volatile variables must be read from memory on every access)
    unsigned long m = timer0_millis;
    unsigned char f = timer0_fract;

    m += MILLIS_INC;
    f += FRACT_INC;
    if (f >= FRACT_MAX) {
        f -= FRACT_MAX;
        m += 1;

    timer0_fract = f;
    timer0_millis = m;

The "output" from the Timer 0 overflow are the updated variables: timer0_fract, timer0_millis and timer0_overflow_count.

millis() returns timer0_millis.

You say it is "working fine". Well that's OK then. But it may be working fine for reasons other than you think.

I doubt delay() will work very well. Try this:

void setup ()
  TIMSK0 &= ~_BV (TOIE0);
  Serial.begin (115200);

void loop ()
  delay (5000);
  Serial.println (millis ());

That prints a whole lot of zeroes (showing millis() is not incrementing) and the delays are a lot less than 5 seconds.

Thanks for your valuable input, Nick!

I will end up using another interrupt for V-USB instead of the default INT0.