Example: I2C using SC126 and PCF8574

I2C using SC126 and PCF8574

This example shows how to add a simple I/O expander chip to the I2C port of SC126 (Z180 SBC/Motherboard).

The PCF8574 provides 8 input/output lines, each of which can be written to or read from. Each input/output line can be set low (open collector) or set high (weak pull-up). The input/output line can also be read, allowing it to act as an active low input when set to output high.

Source code and other files can be found here.

This example source code has be written to be assembled using the Small Computer Workshop (SCW) and the resulting Z80 program downloaded to the Small Computer Monitor (SCM) and executed from there.

The program makes use of SCM’s API for the delay routine, so porting the code to run elsewhere will require a suitable delay routine to be substituted.

Update 5-Jan-2021
Another example of I2C code can be found here.

Homebrew 8-bit retro computing