> From: Mayes uk > > Hi, > > I have looked around and found lots of code to implement > I2C master PICs, but I haven't found any code for > bit banging I2C slave. > > Is there an ANxxx covering this? > Has anyone got some code they could e-mail me, or pointer > to some code? As I mentioned in a previous post, the timing requirements for the I2C slave even at 100KHz are too severe for a software implementation. This is why the 16CXX series implement a slave I2C in hardware, but leave the master implementation to software. The reason for this disparity is that the master drives the clock line, whereas the slave has to follow the clock and respond if necessary within quite tight timing constraints. This problem may be mitigated somewhat if you are writing both master and slave. In this case, the master can be aware that the slave is slow and thus relax its clock rate to, say, 10KHz. Strictly speaking, it is no longer an I2C slave, but may well be good enough for the application. Regards, SJH Canberra, Australia