We do have interrupts but I'm blowed if I can see how I create a task that will respond to an I2C command. I could monitor the SDA pin and do a sort of "reverse bit-bang" but that would surely overload this little critter when other I2C commands are being processed by other devices.
Can I get an interrupt from the I2C state machine so I can at least do something like this?
Code: Select all
Global
value-list
I2C Int handler
read target address
if not "me" then return
get command byte
process-command (ie return my current value-list)
send results to I2C master
return
Main
init I2C (including our address)
init value-list
do forever
get analogue values
process values and store in value-list
blink activity led
wait 1 second
David Goadby, North Wales.