i2c bit banging

hesinije

Member
Dear all,

Does anyone know if there are any examples somewhere on programming a picaxe as an i2c slave device? There seem to be lots of examples about programming a pic as i2c slave but I don't speak the pic language.

thanks,
Herman, NL
 

hippy

Ex-Staff (retired)
I don't think it can be done.

An I2C Slave has to respond to what the I2C Master throws onto the bus in a timely manner and the PICAXE doesn't have the speed to do that.

There is 'clock-stretching' whereby the I2C Slave can slow down the I2C Master's clocking to allow it to have enough time to do what is needed, but I'm not sure where such stretching can be effected, and it would require an I2C Master which recognised it was having its clock stretched.

The PICAXE would also have to expediently pull the SCL line low to let the I2C Master know it was having its clock stretched. This would probably require external hardware to get the response time up, and the Start and Stop conditions may need special treatment.

An exampe of using a PICmicro as an I2C Slave in PicBasic ( not PICAXE Basic ) can be found here ...

http://www.microengineeringlabs.com/resources/samples/pbp/i2cslave.bas

That's probably a lot clearer than the assembly language examples.
 
Top