SCM App, I2C Demo version 2.1

This App demonstrates how to use a range of I2C devices. It includes support for devices in the SC400 series of I2C modules. This includes simple I/O devices, such as PCF8574 and MCP23008, and serial EEPROM chips, such as 24LC256.

The code can be configured to work with SC126 and SC137. The I2C bus master is assumed to be at address 0x0C (binary 00001100)

An earlier example can be found here.

The example source code has been 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, so porting the code to run elsewhere will require some work.

Recommended for Z80 and Z180 processors
NOTE: I2C bus master is assumed to be at address 0x0C
Requirements:
Small Computer Monitor (SCM) v1.0 or later
Z80 or Z180 processor
SCM_App_I2C_demo_v2.1.0_code8000.hex
(code starts at 8000)
Version 2.1.0 (2021-02-26)
Source code
SCM_App_I2C_demo_v2.1.0.asm
Version 2.1.0 (2021-02-26)

Below is an example of the terminal output when loading and running the App.

Small Computer Monitor - RC2014
*         <<< send hex file here >>>
*Ready
*
*g8000
I2C demo/test v2.1.0 by Stephen C Cousins
I2C devices found at: 40 42 7E 9A
SC138 Memory card (eg. 24LCxxx) at Write=AE Read=AF
      Device not found
SC402 Memory module (eg. 24LCxxx) at Write=A0 Read=A1
      Device not found
SC403 Digital I/O Module (MCP23018) at Write=40 Read=41
      Output = FE, Input = FE
SC404 Digital I/O Module (MCP23008) at Write=42 Read=43
      Output = FE, Input = FE
SC405 Digital I/O Module (PCF8574) at Write=74 Read=75
      Device not found
SC406 Temperature Sensor Module (TC74) at Write=9A Read=9B
      Temparature 'C (in hex) = 17 17 17
SC407 Switches and Lights Module (PCF8574) at Write=7E Read=7F
      Output = 00, Input = 00
      Output = FF, Input = EF
*

Homebrew 8-bit retro computing