Pages: [1]   Go Down
Author Topic: store, days passed counter, to eeprom  (Read 1123 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi from a newbe !
In my project ,micro controller need to change some  values of the program, depending to the days that passed.
For example if we are on day 1 ,the he keep the temperature of the room ,to 23 Celcius . On day 2 the temperature must set to 25 C.
I will use an internal clock to count days.Something like this code http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227406778/all
The problem is that  if power lost (or reset) , then the arduino will start again fron day one.
I want every 6 hours arduino ,store the days passed  (2 days and 6 hours, or 2 and 1/4 ,or something similar).So  and after every reboot ,arduino, first read those data and continue counting. If I store time every minute ,maybe it will be a problem with eeprom and from the other hand, loosing 6 hours is not a big problem .
If my all idea of solving this problem is wrong, please feel free to guide me. Thank you
« Last Edit: April 04, 2011, 07:23:32 am by dalai » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46227
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For how many days? One byte of EEPROM could store 1/4 days, with a value up to 255, which would be 63.75 days. Every 6 hours, increment the number stored. On reset (intentional or otherwise), read the number stored.

If the length of time that the function is to cover is significantly less than 63 days, you could decrease the interval between saving, with a corresponding change in what the saved value represents (1/4 of a day, 1/6th of a day, 1/8th of a day).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will count about 50 days.
My best choice would be to backup timer  every 1 hour, but i read that ,internal eeprom will have problem with many read/writes.
If you think that  writing every 1 hour for 1-2 years working period is not so much ,then maybe its for the best to choice more accuracy ,on backup counter.
« Last Edit: April 04, 2011, 07:35:56 am by dalai » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The EEPROM is good for 100,000 writes so that should be good.

Quote
1 hour for 1-2 years
That's still only 17520.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12483
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In my project ,micro controller need to change some  values of the program, depending to the days that passed.

Sounds like you need to add a RTC (real Time Clock) check the DS1307 You can just read the day month year hour Minute second ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: