How about always keeping an extra 'pointer', ie for successive writes: FD FD 05 06 07 08 09 etc. one write later: FD FE FE 06 07 08 09 etc one write later: FD FE FF FF 07 08 09 one write later: FD FE FF 00 00 08 09 etc. and FD FE FF 00 01 01 09 etc. Cost is memory space of one record.. just search for the duplicate.. even easier though is to have a pointer somewhere else pointing to the newest record.. ----- Original Message ----- From: Dwayne Reid To: Sent: Tuesday, November 30, 1999 11:17 PM Subject: challenge - which number is higher > I have an interesting problem that I'd like to throw to the gurus. > > I am storing a number of records in eeprom - kind of a circular buffer > arrangement. Part of each record is a 1 byte number used as a 'sequence' > counter - its purpose is to tell me which record is the newest. The counter > will start at 00, increment to FF, then roll over back to 00. > > This is the challenge: how to tell which number is highest. The records > are stored in a fixed sequence, with the oldest record being overwritten by > the current record. Again, the sequence number is part of the record being > stored. > > When the system powers up, I need to retreive the newest record and stick it > into RAM. > > Eg. Read the sequence number from 8 records and find the most recent record. > > 00 01 02 03 04 05 06 07 (easy) > F9 FA FB FC FD FE FF 00 (harder) > FE FF 00 01 02 03 04 05 (harder) > > The problem is dealing with the wrap from FF to 00. > > Thoughts, ideas? > > dwayne > > > > Dwayne Reid > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > (780) 489-3199 voice (780) 487-6397 fax > > Celebrating 15 years of Engineering Innovation (1984 - 1999) > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > Do NOT send unsolicited commercial email to this email address. > My posting messages to Usenet neither grants consent to receive > unsolicited commercial email nor is intended to solicit commercial > email. >