Pages: [1]   Go Down
Author Topic: "Year 2000 problem" in Arduino  (Read 1568 times)
0 Members and 1 Guest are viewing this topic.
Changchun
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The micros( ) in wiring.c function using the the variable timer0_millis, which is defined volatile unsigned long timer0_millis , the maximum value is oxFFFFFFFF . It adds MILLIS_INC on  each Timer0 interrupt(at 12MHZ clock, the MILLIS_INC = 1).  After  (0xFFFFFFFF/MILLIS_INC) Timer0 interupts,  timer0_millis will become 0 on next interrupt, so the delay( ) function will  occur the "Year 2000 problem" , because it uses if (((uint16_t)micros() - start) >= 1000) ,which the micros() is equal  timer0_millis.

At about 68 days, it maybe accur "Year 2000 problem".

by Rom Huang
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 637
Posts: 34581
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

All this is well known so:-
So what is your point or question?
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

At about 68 days, it maybe accur "Year 2000 problem".
I would assume that is why the millis() reference page (http://arduino.cc/en/Reference/Millis) says:  "This number will overflow (go back to zero), after approximately 50 days."

The solution is very simple and well documented:
http://arduino.cc/playground/Code/TimingRollover
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Pages: [1]   Go Up
Jump to: