Page 1 of 1

SUB-20 I2C Slave address

Posted: Fri Jul 09, 2010 8:03 pm
by ZWENG
I am using Sub-20 to simulate my one of slave child board when I test my main control board. Does anybody know the steps to setup sub20 as salve mode. How to set the slave address? I got limited time to get this work, so I post this for help. Thanks. vb.net is used.

Re: SUB-20 I2C Slave address

Posted: Sat Jul 10, 2010 2:25 am
by serg
I know. The following info taken from the sub20.net document

I2C Methods
Boolean I2C_SetConfig(Integer SlaveAddress, Integer Flags )
Configure SUB-20 I2C module.
Parameters:
Integer SlaveAddress – slave address for SUB-20 in I2C slave mode.
Integer Flags – flags. Can be set to I2C.I2C_GCE.
Return Value:
Returns true if successful, false otherwise. Call GetLastError method to
get an extended error information

The I2C slave setup sequence is the following

Sub20.FIFO_SetConfig(Xdimax.Fifo.SelectI2C)
Sub20.I2C_SetConfig(SlaveAddress, 0)
Sub20.FIFO_Read(...) or Sub20.FIFO_Write(...)


Regards