Andy Kunz wrote: > Anybody use the I2C slave mode hardware in the 16C pics? Yes, I have. > Any ideas, comments, etc? Check out the PIClist archive: while I was struggling to get it working, I queried PIClisters a lot. The thread is titled "SSP in I2C problem" or something very similar. If you follow that, it may help you without having to wait for this thread to unravel again. There are several critical points: Chiefly the R/W flag only holds the R/W bit of the slave address just after that byte has been received. After that, it holds the ACK bit of the last data byte received. Knowing this allows you to have interrupt-driven I2C (you have to keep a copy of the R/W bit to know the message direction on the next I2C interrupt). Also note that the SSP will interupt the CPU after every byte read by the I2C master is acknowledged. So your I2C master MUST remember to NACK the final byte. Otherwise your slave will lock up, thinking "hey, I sent the last message byte for the protocol, whats this interrupt for?". My I2C master (written by a colleague) does not, so I had to unstick the SSP by loading a dummy byte before operating the CKP bit. The first bit (MSB) of the an outgoing byte appear on the SDA pin as soon as the SSPBUF is loaded, so the MSB of the dummy byte must be high. While discovering that, I found that SCL rises as soon as CKP is operated, so I also needed a delay between loading SSPBUF and operating CKP, to satisfy the I2C data setup time. Microchip's app notes are a total crock. Use them as a 'spot the stupid mistake' exercise. These tips should save you the huge arseache of finding them out yourself. Believe me, it was a _long_ struggle. You owe me one large cyber-beer. :-) Keith PS: Once you get the hardware going, you still have lots of work defining an I2C network protocol. You need to write I2C calls in such a way that the application code can make decisions between recieving data bytes and acknowledging them if needed. Application code needs to handle bus errors, backoff and retry, how many times to retry, what to do if slaves are not there, etc. One modem driver does not mean you have an internet. :-)