I'm having trouble figuring out how to use I2C from within the C18 compiler. Here's my code to read a byte from an X1226: unsigned char ReadU8eep(unsigned int addr){ // Read a byte from eeprom chip at addr unsigned char data; // Keep our data while we close the I2C OpenI2C(MASTER, SLEW_ON); // Initialize the I2C as a master // SSPADD=22; // 400 kbps with 40 MHz clock SSPADD=0xff; IdleI2C(); // Wait for i2c to be ready StartI2C(); // Send a start IdleI2C(); // Wait for i2c to be ready WriteI2C(0xae); // Send the slave address with the r/-w low indicating we're writing an address IdleI2C(); // Wait for i2c to be ready WriteI2C(0xff & (addr>>8)); // Send the high half of the address address IdleI2C(); // Wait for i2c to be ready WriteI2C(0xff & addr); // Send the low half of the address IdleI2C(); // Wait for i2c to be ready StartI2C(); // Send a start IdleI2C(); // Wait for i2c to be ready WriteI2C(0xaf); // Send slave address with r/-w high indicating we're reading IdleI2C(); // Wait for i2c to be ready data=ReadI2C(); // Get the data IdleI2C(); // Wait for i2c to be ready StopI2C(); // Send an I2C stop IdleI2C(); // Wait for i2c to be ready CloseI2C(); // Done with I2C return(data); // Exit with the data we got } The documentation on the I2C library only gives sample code for talking with Microchip EEPROMs, so I had to try to figure out how to talk with the Xicor part. I'm assuming IdleI2C() is required between instructions to insure the SPP has finished the previous instruction. Watching the transaction on a scope, the problem SEEMS to be with the StartI2C() after sending the low half of the address. After the 8th clock, another clock is sent and data is held low (I assume by the X1226) for an acknowledge. Then, the clock goes low. The StartI2C() seems to do nothing. The clock and data both remain low. After the acknowledge clock (about 12us) is a very short clock (less than 4us). It appears the data line is released at the same time as the clock line. This MIGHT be an attempt at sending a start, but it clearly fails. The clock goes low after the 4us or so while data remains high through the next full clock (the start of sending 0xaf). When we get down to reading data back using ReadI2C, the data line just stays high. I think the EEPROM ignored the command to output its data because of the lack of a start. So, anyone done I2C using C18? Thanks! Harold FCC Rules Online at http://hallikainen.com/FccRules Lighting control for theatre and television at http://www.dovesystems.com Reach broadcasters, engineers, manufacturers, compliance labs, and attorneys. Advertise at http://www.hallikainen.com/FccRules/ . ________________________________________________________________ GET INTERNET ACCESS FROM JUNO! Juno offers FREE or PREMIUM Internet access for less! Join Juno today! For your FREE software, visit: http://dl.www.juno.com/get/web/. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.