View previous topic :: View next topic |
Author |
Message |
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Feb 06, 2015 5:23 pm Post subject: read of flash memory |
|
|
Hello,
The datasheet of a Atmega 328 (arduino type) say Write/Erase Cycles: 10,000 Flash/100,000 EEPROM but nothing about the read cycle.
I have to write some bytes in the EEprom (2 times a year), but I have to read them every seconds
I have 2 questions :
A) How many times to read 2 bytes in EEprom with 16Mhz crystal (approx ?)
B) Is the fact to read EEprom affect the live of EEprom ?
Many thanks for you answers
JP :wink:
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Feb 06, 2015 5:55 pm Post subject: Re: read of flash memory |
|
|
Duval JP wrote: | A) How many times to read 2 bytes in EEprom with 16Mhz crystal (approx ?) |
Till the end of days. Or at least the 20 years which are guaranteed by the datasheet for data retention.
Quote: | Is the fact to read EEprom affect the live of EEprom ? |
No. Reading doesn't change anything, writing does. The amount of changes is what kills the cells. |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Feb 06, 2015 6:22 pm Post subject: |
|
|
thanks for the second answers.
But I did an error in ma first question. I meant : How long does it take to read a eeprom byte ?
JP |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Feb 06, 2015 6:57 pm Post subject: |
|
|
Duval JP wrote: | But I did an error in ma first question. I meant : How long does it take to read a eeprom byte ? |
Datasheet:
Quote: | When the EEPROM is read, the CPU is halted for four clock cycles before the next instruction is executed. |
How many cycles it takes to enter and exit Bascom's EEProm routines, you should be able to check in the simulator.
But there is no additional (3.6 ms) delay similar to writing the EEProm. |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Feb 06, 2015 7:42 pm Post subject: |
|
|
many thanks , very fast ! very GOOD |
|
Back to top |
|
|
Arera
Joined: 23 Sep 2007 Posts: 386 Location: Wuppertal, Germany
|
Posted: Sat Feb 07, 2015 1:46 pm Post subject: |
|
|
maybe it's faster to copy the eeprom byte to RAM at powerup, and after changing the content. Then use the RAM.
You could even easily do calculations on the RAM-byte, and afterwards copy it back to the EEPROM.
The EEPROM is only a store, not a "workspace" (cannot find a more suitable word here...). |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Sat Feb 07, 2015 5:07 pm Post subject: |
|
|
Thank you for your comment, but I have to go through this reading eeprom every second. I do a clock and I need to know if I am "summer time" or "winter time" for changing bi-annual hour.
I use a RTC with battery backup but this parameter is not saved and I'm afraid by mains power failure.
I write the program and it works, I write the flag only 2 times/year so no problem: 100000/2 =50000 years!
Encore merci
JP |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sat Feb 07, 2015 10:32 pm Post subject: |
|
|
Only for info and example. Some RTC like PCF8583 have free unused 240 bytes RAM and can hold Your data with battery backup. |
|
Back to top |
|
|
|