Example: I2C Demo version 2

This example code includes support for simple I/O devices, such as PCF8574 and SDAA1300, and serial EEPROM chips, such as 24LC256.

The code can be configured to work with SC126 and SC137.

An earlier example can be found here.

I2C using PCF8574

This example shows how to add a simple I/O expander chip to an I2C bus.

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.

I2C memory

The example program supports single byte random access and also block transfer, using a 24LC256 serial EEPROM chip. This is the chip used on the I2C memory card SC138.

Tools

The 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 example code 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.

Homebrew 8-bit retro computing