Finally I had a bit time to play with my Propeller board I got sitting around for half a year now. I wish it had more I/O ports, but with an “Remote 8-bit I/O expander for I2C-bus” this is a solvable problem. Only got to write a driver for it.
Which turns out to be far easier than I thought.
Here is the driver program. All of it. It’s using an I2C driver but that one is surprisingly simple too.
i2cObject : “Basic_I2C_Driver”
i2cObject.Write (i2cSCL,_deviceAddress | 0)
i2cObject.Write (i2cSCL, i2cData)
PUB ReadPort(i2cSCL,_deviceAddress) : i2cData
i2cObject.Write (i2cSCL,_deviceAddress | 1)
i2cData := i2cObject.Read(i2cSCL,i2cObject#NAK)
And now to use it:
‘ setup i2cobject
That will lit LED 0-3 and turn LED 4-7 off. Simple eh? And worked on the first try!