Hi,
You need the i2c slave lib (which is a separate product).
Simple put when something happens on the i2c bus the lib calls the defined routine (that you write) to handle the action. For example:-
[code:1:e8fed973e2]
'Byte received from Master
'Twi holds the value sent
'Twi_btw holds the index
Twi_gotdata:
ByteFromMaster = Twi 'Receive from master
Return
'Master wants byte
'Twi_btr holds the index
'Twi should contain the value to be sent when the callback ends
Twi_master_needs_byte:
Twi = 1 'Return Byte '
Return
[/code:1:e8fed973e2]
I would still recommend using an ISR for driving the stepper motors, but it's your choice.
Regards
Ian Dobson
↧