Attached, please find an example assembly language program for bit-banging low-level I2C
start,
write, and
stop functions for PIC devices that do not have a hardware I2C peripheral (MSSP). The program is rather crude and pretty much the bare minimum necessary to drive a PCF8574 based I2C LCD backpack and HD44780 display. The program weighs in at 172 words of program memory and uses 4 bytes of RAM memory.
The 16F690 target uses the 8-MHz INTOSC and the I2C clock is being driven at 100-kHz. Low-level LCD
init,
putCmd, and
putDat functions support the backpack and display. It takes ~617-us to write a byte of data to the LCD so throughput is equivalent to about 13000 baud.
Have fun... Please let me know if you have any questions...
Cheerful regards, Mike, K8LH