Using I2C with a BS1
RonHarsh
Posts: 1
Sorry if this has been beat to death already but I would like to use some serial EEPROMs with a BS1. Has anyone written code to perform I2C two wire serial with the BS1?
Carry On!
RonHarsh
Carry On!
RonHarsh
Comments
You can do I2C with a BS1 but you have to do it manually (bit-banging) because there are no built-in I2C functions in the BS1. I have attached a demo program I wrote for the BS1 that reads the seconds from a DS1307 RTC and sends the ones digit out to a PCF8574A port extender as a binary clock. The I2C routines and the main program take up about 1/2 of the BS1 memory, so there is still space left if you aren't doing anything too complex with the data.
The I2C routines are optimized for this application. Specifically, only one byte can be read at a time, as an ACK is not sent after the byte is read from the I2C bus. This tells the I2C device to stop sending more data. If you want to read more than one byte at a time, you will need to modify the I2C receiver routine to send an ACK for all but the last byte.