C# sub_find_devices

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

Moderator: serg

Post Reply
nebruin
Posts: 2
Joined: Sun Jul 04, 2010 4:47 am

C# sub_find_devices

Post by nebruin »

I've been looking through the documentation for the Sub-20 device, and I see a function called sub_find_devices listed in the manual, but I can't seem to find this anywhere in the C# assemblies. Is this function exposed in the C# libraries?

Thanks.

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

Re: C# sub_find_devices

Post by serg »

Hi,
The method corresponding to the sub_find_devices function is "GetNext", see the sub20net document for more information. The document conains a VB example which shows usage of this method
Regards

nebruin
Posts: 2
Joined: Sun Jul 04, 2010 4:47 am

Re: C# sub_find_devices

Post by nebruin »

Thanks for the reply, but in the C# library that function is not exposed. Here is the output from the metadata from the assembly.

public Sub20();
public bool ADC_Read(Array data, Array mux);
public bool ADC_Read_r(ref Array data, Array mux);
public bool ADC_SetConfig(int flags);
public bool ADC_Single(ref int data, int mux);
public bool Close();
public override sealed void Dispose();
protected virtual void Dispose(bool __p1);
public bool FIFO_Read(Array Buffer, int Timeout_ms, ref int Transferred);
public bool FIFO_Read_r(ref Array Buffer, int Timeout_ms, ref int Transferred);
public bool FIFO_SetConfig(int config);
public bool FIFO_Write(Array Buffer, int Timeout_ms, ref int Transferred);
public bool FPWM_Config(float Freq, int flags);
public bool FPWM_SetConfig(float Freq, int Flags);
public bool FPWM_SetDutyCycle(int OutputIndex, float DutyCycle);
public string GetBlVersion();
public string GetDllVersion();
public string GetDriverVersion();
public string GetFwVersion();
public int GetLastError();
public string GetName();
public string GetSerialNumber();
public string GetStrError(int errnum);
public bool GPIO_GetConfig(ref int config);
public bool GPIO_Read(ref int value);
public bool GPIO_SetConfig(int config, int mask);
public bool GPIO_Write(int value, int mask);
public bool I2C_GetFrequency(ref int frequency);
public int I2C_GetStatus();
public bool I2C_IssueStart();
public bool I2C_IssueStop();
public bool I2C_Read(int SlaveAddress, int MemoryAddress, int MemoryAddressSize, Array Buffer);
public bool I2C_Read_r(int SlaveAddress, int MemoryAddress, int MemoryAddressSize, ref Array Buffer);
public bool I2C_Scan(Array Buffer, ref int SlaveCnt);
public bool I2C_Scan_r(ref Array Buffer, ref int SlaveCnt);
public bool I2C_SetConfig(int SlaveAddress, int flags);
public bool I2C_SetFrequency(ref int frequency);
public bool I2C_Write(int SlaveAddress, int MemoryAddress, int MemoryAddressSize, Array Buffer);
public bool LCD_Write(string str);
public bool Mdio22(int Op, int PhyAddr, int RegAddr, int Data, ref int Content);
public bool Mdio45(int Op, int PortAddr, int DevAddr, int Data, ref int Content);
public bool Open(int @ref);
public bool PWM_SetConfig(int Resolution_us, int Limit);
public bool PWM_SetDutyCycle(int OutputIndex, int DutyCycle);
public bool RS_GetConfig(ref int config, ref int baudrate);
public bool RS_Read(Array Buffer, ref int Transferred);
public bool RS_Read_r(ref Array Buffer, ref int Transferred);
public bool RS_SetConfig(int config, int baudrate);
public bool RS_SetTiming(int flags, int tx_space_us, int rx_msg_us, int rx_byte_us);
public bool RS_Transfer(Array OutBuffer, Array InBuffer, ref int Transferred);
public bool RS_Transfer_r(Array OutBuffer, ref Array InBuffer, ref int Transferred);
public bool RS_Write(Array Buffer, ref int Transferred);
public bool SPI_GetConfig(ref int config);
public bool SPI_Read(Array Buffer, int ss_pin, int ss_mode);
public bool SPI_Read_r(ref Array Buffer, int ss_pin, int ss_mode);
public bool SPI_SetConfig(int config);
public bool SPI_Transfer(Array Buffer, int ss_pin, int ss_mode);
public bool SPI_Transfer_r(ref Array Buffer, int ss_pin, int ss_mode);
public bool SPI_Write(Array Buffer, int ss_pin, int ss_mode);

There are no GetNext functions.

Thanks.

-Nebruin

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

Re: C# sub_find_devices

Post by serg »

Hi Nebruin,
The assembly actually exposes two classes: Sub20 and Sub20Enum. The GetNext method belongs to the Sub20Enum class. See the sub20.NET document for more information. The section related to the GetNext method includes a VB.NET sample code which shows how to find a board by serial number

Regards

Post Reply