On Mon, 16 Mar 1998 20:45:07 -0200 Thomas Fleckenstein writes: [...] Not many people have answered this so here goes. >I need to know: >1. How does the IIC routine has to look like. For just controlling an EEPROM, you don't need a full IIC implementation. The parts about multiple-master arbitration and the slave making the master wait by holding clock low don't apply. The timing charts in the EEPROM data sheet are about all you need to know. Since the SCL pin on an EEPROM is always an input, it's OK to just use a PIC pin always as an output to drive it. But you do need a pull-up resistor on the SDA pin and be sure the PIC only drives it low when apropriate. >2. How can I design a ringbuffer with a eeprom connected via IIC bus. There's nothing too magic about this, just write bytes in sequence and wrap around at the end. The problem is you also need to store pointers to the start and end of the data to find it again. Storing the pointers in fixed locations in EEPROM will cause these locations to wear out much faster than the rest of the chip, since they are written every time data is stored. If it's OK for the buffer to become empty when power is lost, just keep the pointers in PIC RAM. When the power comes on again, set them to a "random" value so the first bytes in EEPROM aren't reused over and over again. I think a good way to keep the buffer state permanently would be to store special marker bytes or sequences of bytes (that are certain not to occur in the actual data) to indicate the start and end of the valid data. To add data, the PIC would scan for the marker, overwrite it with new data, and write a new marker. This way the wear on the EEPROM is better (more evenly) distributed. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]