Closed aikopras closed 2 years ago
Hi I think I understand what causes my problem: I'm using millis() to check if one millisecond has passed. From inspecting the wiring.c code I understand that millis() uses Timer0, with a 64 prescaler and overflow after 256 ticks. With a 11.0592Mhz XTal this gives an overflow every 1.481 ms. Therefore I can't use millis() to check if precisely 1ms has passed; I should use micros() for that.
Sorry for bothering Aiko
Hi
It seems millis() is not working well with my board (ATMega 16 / F_CPU=11.0592). I had problems in one of my projects, and therefore I checked timing using my Hantek DSO together with Pulseview. It turned out that each call to millis() takes (roughly) 1,5ms, thus 50% too long. Micros() is working well, however.
I can reproduce this with the following testcode:
Any clue?? Bye, Aiko