Just remember that.....your current eeprom address holds the latest data, while the address+1 holds the earliest data point you are keeping. Unless address=9 then the earliest is 0, but all very easy to keep track of once you read it out eventually. >From: "Mccauley, Daniel H" >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC]: Storing 10 Sets of Data to EEPROM and performing revol > ving updates ? ? ? >Date: Fri, 16 May 2003 11:33:45 -0400 > >Yes, that makes perfect sense. I think with a scheme like this you could >easily implement up to 1000's of stored datapoints very easily (with the >proper EEPROM of course). > >Thanks again. > >Dan > > > > > Does the newest datapoint *have* to be in location 10? If > > not, then you > > could just keep an index that pointed to the current memory > > location, and > > have it wrap back to 0. something like: > > > > index = 0; > > while (recording) > > { > > WriteMemory(index, measurement) > > (index^9)?index++:index=0; > > //increment index, > > but wrap to zero if index==9 > > } > > > > > > where WriteMemory() is whatever function you use to > > store your data > > that specifies address and measurement to store. I guess you > > get the idea. > > You can re-read the data newest to oldest just by knowing the value of > > , since that was the last address you stored. when > > re-reading, you > > would just have to decrement the index, and wrap from 0 to 9. Same > > principle, though. > > > > hope that makes sense > > > > > -----Original Message----- > > > From: Mccauley, Daniel H [mailto:daniel.h.mccauley@LMCO.COM] > > > Sent: Friday, May 16, 2003 10:22 AM > > > To: PICLIST@MITVMA.MIT.EDU > > > Subject: [PIC]: Storing 10 Sets of Data to EEPROM and performing > > > revolving updates ? ? ? > > > > > > > > > For my project I wish to do the following: > > > > > > For each measurement I take with this electronic timing > > device (my PIC > > > controlled device), I want to store the result as following: > > > > > > Measurement 1 - Result 1 > > > > > > For the next measurement, the data would be stored in: > > > > > > Measurement 2 - Result 2 > > > > > > This would go so on until 10 Results are stored. Since I am > > > only storing 10 > > > results, for the 11th measurement, I want to discard the oldest > > > datapoint and store the new datapoint at location Result 10. > > > > > > So basically I'm only storing the last 10 Results and always > > > dropping the > > > oldest to allow room for the newest result. > > > > > > My question is, what is the best way to code this??? (I'm > > using CCS C > > > compiler) Do I move actual data through EEPROM everytime > > > the 11th, 12th, so on results are being stored, or is it > > > better to change > > > the actual EEPROM storage address. > > > > > > Any help appreciated!!! > > > > > > D > > > > > > -- > > > http://www.piclist.com hint: To leave the PICList > > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu _________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu