SUB-20 I2C Slave address

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
ZWENG
Posts: 1
Joined: Fri Jul 09, 2010 7:58 pm

SUB-20 I2C Slave address

Post 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.

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: SUB-20 I2C Slave address

Post 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

Post Reply