Go Down

Topic: "Year 2000 problem" in Arduino (Read 1 time) previous topic - next topic

rom

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

Grumpy_Mike

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

James C4S


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
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up