Sequential write to EEPROM on the stamp
ion
Posts: 101
·
Hi ,
I have a problem for which I can not find a solution and I am looking for some help ( code will be highly appreciated)
·
I have a push button and I want to write a value of a word (from an A/D converter) ·in a defined ·memory location each time the button is pressed ( do not jump yet).
At next power up I would like to be able to read the stored data until I press the button again and overwrite the old value with a new one (still just do not jump yet because this is done with a write command).
The EEPROM on the new BS2PX is rated at 1 million write cycles. My counter will go beyond that point, to 10 million counts the max. ( due to the length of other code involved I can not use a BS2 rated at 10 millions write cycles).
The solution that I look for is to write to ·a memory address the A/D word value, and on the other location to write a tracking number (will be two words because I would like to count to 900000,· Whigh=90 ,Wlow=0000) , so I know how many time I used that memory. At 900 thousands I would like to move the storage location of the A/D to the next memory address, and in the same time I would like to move the tracking location too to an other location. In this way, I can write with no problem a value more then 1 million times to the stamp.
Any help or guidance will ?
·
Thank you
Ion
·
Hi ,
I have a problem for which I can not find a solution and I am looking for some help ( code will be highly appreciated)
·
I have a push button and I want to write a value of a word (from an A/D converter) ·in a defined ·memory location each time the button is pressed ( do not jump yet).
At next power up I would like to be able to read the stored data until I press the button again and overwrite the old value with a new one (still just do not jump yet because this is done with a write command).
The EEPROM on the new BS2PX is rated at 1 million write cycles. My counter will go beyond that point, to 10 million counts the max. ( due to the length of other code involved I can not use a BS2 rated at 10 millions write cycles).
The solution that I look for is to write to ·a memory address the A/D word value, and on the other location to write a tracking number (will be two words because I would like to count to 900000,· Whigh=90 ,Wlow=0000) , so I know how many time I used that memory. At 900 thousands I would like to move the storage location of the A/D to the next memory address, and in the same time I would like to move the tracking location too to an other location. In this way, I can write with no problem a value more then 1 million times to the stamp.
Any help or guidance will ?
·
Thank you
Ion
·
Comments
·· How often will you be sampling data that you will use up all the write cycles (lifetime) of the EEPROM, and how long do you expect that to take?· Just curious...It would seem you would have to be sampling the data pretty darn quickly, and then what would be done with it?· You better have a pretty fast button-pusing finger too, since you say this will happen·when you·push·a button.· Are you sure you don't mean that you need 10 million memory locations?· That's extremely high, and probably unliekly, but I had to ask.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I sample the data every 10 seconds on a 24 hours 7 days a week frequency
This will give me 5000 samples in a 24 hours interval. The product should last for 5 years in a 24/7/365 configuration.
I do not need 10 million locations. I need to write to the same one 1 million times , then move to the next one. 10 in total ( actually 20 because it is a word)
For tracking I need 20 for high word and 20 for low word. With a PX it can be done in one bank with 60 location in total. The trick which I can not solve is how to track and change from one location to the next one when my write cycle ( from tracking words ) read 1 million.
Ion
·· Okay, I understand...Now, two things...One, unless you absolutely must have non-volatile storage of the last data, you could use RAM.· In fact, you could use a Serial RAM chip with Battery Backup and have virtually unlimited write cycles.
·· Or you could use an external EEPROM and simply replace it when you wear it out.· Given that you're using the same location(s), I would opt for the Battery Backed RAM.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks
Ion
EePntr···· DATA··· 0
Samples··· DATA··· Word 0 (10)
Put_Sample:
· READ·EePntr, idx
· WRITE Samples· + (idx * 2), Word adcSample
· idx = idx + 1 // 10
· WRITE EePntr,·idx
· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I will try it write now
Ion
I have a question about the sample:
The pointer is writen every time , so it will not wearout after 1 million writes. How i can switch the location of the pointer after one million write cycle?
Thanks
ion
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Ion
How about something like this,
' rotating pointer gives 65535 writes per location, total 24 million with 256 pointer values before repeat
' to write ...
STORE 7
READ 2047, pointer ' pointer is 0 to 255
WRITE pointer*4, Word ADCresult
READ pointer*4 + 2, Word tracking
WRITE pointer*4 +2, Word tracking+1
IF tracking=0 THEN ' this location has been used 65536 times
WRITE 2047, pointer+1 ' move to next location
WRITE pointer*4, Word ADCresult ' save ADC result in new loc
WRITE pointer*4+2, Word 1 ' start tracking at number 1
ENDIF
That changes the pointer location only 256 times to get 24million total writes, but uses 1k bytes of eeprom in slot 7. It is not hard to make the tracking counter 3 bytes to save memory, if that is tight. I would not try to push it close to the 1 million figure. That is a statistical measure.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
It is a new interesting way , and i will try it now.
Thank you again to all of you guys for help
Ion