Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Debugger: Surprising values of cycle counts with and without interrupts

2 posters

Go down  Message [Page 1 of 1]

n3645



Code:


   // Test at UNO simulator

    delay(1000);     // around 16M cycle counts - almost correct

    noInterrupts();
    delay(1000);     // around 92500 cycle counts ?!?
    interrupts()


The value is never the same, though...

However, upper was quite a surprise! I'm not certain that is the bug in arduino code or simulator, though. Execution is 173 times faster when interrupts are disabled in simulator!

arcachofo

arcachofo

This is because delay() uses interrupts, so you can't use with interrupts disabled.

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum