I want to simulate an I2C slave device using a generic 8051 MPU which doesn't have hardware I2C(not like 80C552). I know it is easy to implement software simulated I2C in master mode, but I want to turn my 8051 MPU to be a slave device. How can?
Hi Cal, Just clarify what you ment by "however the data received is DEFINITELY not being sent. I think the problem may be timing between the transmitting and receiving or the my method of receiving the data." If your slave is triggering on the START condition then from the I2C protocol "Data on the SDA pin may change only during SCL low time periods". So if you look at the following it should hopefully help:-
jb SCL,$ ;get past "START" condition REPT 8 ;repeat block get all 8 bits of data jnb SCL,$ ;wait for clock to go high mov c,SDA ;read data transmitted MSB first rrc a ;and save it ENDM