I'm using C18 compiler and 24LC256 EEPROM. I would like to know how to handle **Rollover** case in terms of large EEPROM write.I'm writing a Routine that writes 120 Bytes every half an hour and i would like to know how can i save/store my data easily as Page Write will take only 5 ms as equal to a single write operation.The Page size here is 64 Bytes.And i have to write for 10 hours making it 2.4 K space per day.


Well the problem i have is:

1.I want to use Page Write Efficiently and wants to prevent Roll over condition.
 page size starts from 0-63 , 64-127 ,128-191,192-255...up to 32 K.
 I want to  Predict when is the Page Limit coming and wants the Page Write to shift     accordingly.

eg:
If i start with 0th address: 0-63 will occupy 64 bytes and 64-117 will occupy the next 56 Bytes.
Then for the next Page Write i can only write 20 locations and have to write 64  and 20 in another two Page Write Operations.


Note:Dedicating starting Page Locations for each Page Write is not required.

    Page write operations are limited to writing
    bytes within a single physical page,
    regardless of the number of bytes actually
    being written. Physical page boundaries
    start at addresses that are integer
    multiples of the page buffer size (or ‘page
    size’) and end at addresses that are
    integer multiples of [page size - 1]. If a
    Page Write command attempts to write
    across a physical page boundary, the
    result is that the data wraps around to the
    beginning of the current page (overwriting
    data previously stored there), instead of
    being written to the next page, as might be
    expected. It is, therefore, necessary for the
    application software to prevent page write
    operations that would attempt to cross a
    page boundary

I have been trying to find an algorithm to do so. It would be extremely helpful if you sort out this issue or suggest your insights.

Regards

Arookie