You could squeeze a little more count range out of this approach by recognizing the special case of 0x400 for the pointer and reusing the byte at 0 for 65536 additional counts (pointer wrap around). You'd only need to test byte 1022 for bit 2=1 on overflows of the low byte of the current counter and increment byte 0 instead of 1022. If you bent the spec a bit, since it is a MINIMUM guarantee at MAX temperature, use 131584 as your use limit per byte (32% more than spec) and just go around your 1024 bytes a second time when 1022 is 4 or greater. And you would read back the counter to confirm that it incremented correctly, and if it didn't, increment the pointer AND a 'spare' 'errorcount' byte that would account for this in the 'totals' calculation by subtracting 655356 for the bad cell. The new counter for a bad cell would simply be a copy of the last good count value. Robert Rolf wrote: > So, this thread has been alive for long enough to capture my interest > even though I do not need the solution myself. Here's how I would get > 67M counts ot of 1024 bytes of EEPROM without exceeding 100K writes per > cell (in fact, keeping about 30% lower than the limit). > > Keep two EEPROM bytes for a pointer to EEPROM, these will be the last > two bytes in EEPROM. Initially pointer is set at 0x0000 > > Use a 2 byte counter at the pointer position. Increment that counter at > each event. > At the 2 byte overflow, increment the pointer. This will be at 256^2 > counts (65536). > What was the low byte of the 2-byte counter now becomes the high byte of > the next pointer. > EEPROM now looks like: > 0x00 0x00, 0x00, ..., ... ......., ..., 0x00, 0x01 > > Byte 1 (the second byte) has been written 65K times. > > With the current pointer, Byte 1 will be written another 256 times as > the High byte of the next pointed value, giving a total of > 65792 writes. > > To calculate the count it is a simple case of 65536 * Pointer + 2byte > value at pointer > > My math indicates with 1024 bytes EEPROM the numbers are: > > Max value: 1021 * 65536 + 65535 = 66,977,791 > > byte 0 of EEPROM gets 256 writes. > byte 1-1020 get 65792 writes. > byte 1021 gets 65536 writes. > byte 1022 gets 3 writes > byte 1023 gets 768 writes > > With some more thought, and a more complicated count mechanism, I am > sure I could get close to 100M count in 1024 bytes, but would be much > more complex (I think). > > with 256 bytes EEPROM I could get: 16.5M count > > Rolf > > Gerhard Fiedler wrote: > >>Shawn Wilton wrote: >>>There is no array to speak of. >>> >>>To answer both you and Gerhard: >>>http://atmel.com/dyn/resources/prod_documents/doc2526.pdf >>> >> >>Sorry, but that doesn't answer my question; it's too generic and allows all >>kinds of strategies. How exactly do you get your 50M counts out of 1024 >>bytes of EEPROM storage when writing to each cell max. 100k times? How do >>you structure the buffer? How do you increment the count? How do you >>calculate the current count? >> >>Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist