Pages: 1 2 [3]   Go Down
Author Topic: millis (crystal) accuracy & thoughts  (Read 3891 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So even with a perfectly precise clock you get error.  You can see all this by reading wiring.c

No, there is no error in the millis calculation. The fractional calculations in that code compensate for the number of actual interrupts per microsecond.
Logged

USA
Offline Offline
Jr. Member
**
Karma: 4
Posts: 92
If you can't fix it with a hammer, it must be an electrical problem.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you examine the millis code you will find out this:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279385586/0
Logged


USA
Offline Offline
Jr. Member
**
Karma: 4
Posts: 92
If you can't fix it with a hammer, it must be an electrical problem.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Well researched mspguy, I assumed the millis actually meant millis.

So one may wonder why they didn't /250 by using an output compare interrupt? Or is that used for PWM?

______
Rob

precisely what they did in the Aiko Framework for arduino:
https://github.com/geekscape/Aiko/blob/master/AikoTiming.cpp
Logged


Pages: 1 2 [3]   Go Up
Jump to: