The purpose was to find out how to use my newly bought 24LC256 eeprom chips. This chip holds 256 KBit and is equipped with an I2C connection.
I have used a library written by Dave Ellis (i2cv05.jal). Since eeproms are not exactly fast it is possible that the pic sends a new command before the first one is finished.
This basically means the pic must send a write command (R/W bit = 0) and see if the eeprom acknowledges receipt. If it does not simply repeat until it does acknowledge. At that point the eeprom is ready for a new command. So what does an acknowledge look like? According to the data sheet.
I have added the procedure to the library. Now what could one do with two eeproms that takes 28 minutes? Simple: fill them with sequential numbers (this takes 4 minutes) and then read them back and send the results to the PC at 1200 baud (this takes 10 minutes). And since there are two eeproms it adds up to 28 minutes.
Having two eeproms on the same i2c bus means each has to have a different address. This is controlled by pins A0, A1 and A2 which are the three low bits. Connecting these pins to +5V means a one, floating means 0 because they have internal pull down resistors. So in one eeprom all pins are floating (thus the address is 0), in the other eeprom the A0 pin is connected to +5V (thus the address is 1).
http://members.home.nl/b.vandam/lonely/pagina23.html