eeprom counting dilemma
MichaelDeFalco
Posts: 19
Hi all:
I think I have a mental block.
I am able to store values with the read and write commands to eeprom-no problem.
However, when I turn power off and restart when I begin storing counts to eeprom the data gets over-written
-as I would expect.·
Is there a way to save my counted data and keep incrementing the memory location from my last power down.
I am using a simple "count=count+1"·command to increment the memory reading and writing it into another variable "count_total".
Any direction would be appreciated.
Thanks...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
M.D.
I think I have a mental block.
I am able to store values with the read and write commands to eeprom-no problem.
However, when I turn power off and restart when I begin storing counts to eeprom the data gets over-written
-as I would expect.·
Is there a way to save my counted data and keep incrementing the memory location from my last power down.
I am using a simple "count=count+1"·command to increment the memory reading and writing it into another variable "count_total".
Any direction would be appreciated.
Thanks...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
M.D.
Comments
-Phil
Sorry for the diatribe...
This goes back to my question of storing large counts of last week-I need to have the current count available in a memory location(s)
for upload/download to a computer. (counting parts in real time)
If I do save the last count, I will need to add totals of several saved locations-I need a total count (in the millions) for Preventative Mainenance Schedules as well as daily batch counting.
I would like to keep the system to a few eeprom locations if possible-there could be 50 of these in a single facility.
We would like to minimize the number of registers on a computer system network if possible.
I am pretty new at programming stamps-but am seeing many advantages over PLC's.
Thanks for any comments!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
M.D.
Can you give a simple flowchart-like functional description of what you're doing with these counts?
1. each time a machine cycles I close a switch on an input
2. I increment the count "count=count+1"
3. I send this count to a variable "count_total"
4. I store the "count_total" data to eeprom location 1 via write command for later retrieval via serial port to a computer system
If power is turned off (overnight) and begin counting again; the eeprom location is over-written and I loose the accumulated count
from the previous day. I can't afford to loose the accumulated data - this ties into a quality system...
I hope this helps-Thanks again for your patience
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
M.D.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
for i = 4 to 1
read 2*i-2,word count
write 2*i,word count
next
[noparse][[/noparse]code]
At this point, you can continue counting using EEPROM location 0. This way, if you have a power failure, you've got the last few counts. I'm not sure if the READ/WRITE <addr>,word <var> is the correct syntax to read/write a word. Check the manual.
To throw in a related question amongst my solution, I was wondering if readers of this post know how EEPROM memory is addressed on the BS chips that have multiple banks of EEPROM. I realize that program code must be spread across program slots. But what about addressing EEPROM for extended logging abilities? The BS2pe advertises data logging applications, so I assume the extra memory is in fact addressable from the program slot 0? Any help appreciated on this.
Thank you.
Rick
Look at the description of the STORE command. It sets the memory slot to be used by the READ/WRITE commands.
Thank you much.
Rick