Hi, Here is my situation: I have a USB to I2C adapter built using a Silabs microcontroller. The physical connection to that is done obviously via an USB cable. I want to send/receive information to/from it using NI-VISA. I created an USB driver for RAW usb device and installed it. Everything works fine and in the Measurement and Automation Explorer I can see my device listed.Now I have put together the following code to communicate with my USB to I2c module:#define MAX_CNT 200ViChar buffer[MAX_CNT]; /* Buffer for string I/O */ViSession rsrcMgrHandle, instrHandle; /* Communication channels */ViUInt32 retCount; /* Return count from string I/O*/ int status; // Open Resourcesif ((status = viOpenDefaultRM (&rsrcMgrHandle)) != VI_SUCCESS) { /* Error Initializing VISA...exiting */ return -1; }if ((status = viOpen (rsrcMgrHandle, "USB0::0x10C4::0x84D6::FF::RAW", VI_NULL, VI_NULL, &instrHandle)) != VI_SUCCESS) { /* Error Initializing VISA...exiting */ return -1; } //Ask the device for identification if ((status =viWrite (instrHandle, "*IDN?\n", 7, &retCount)) != VI_SUCCESS) { /* Error Initializing VISA...exiting */ return -1; }….….……// Close Resourcesif ((status = viClose (instrHandle)) !=VI_SUCCESS) { /* Error ClosingVISA...exiting */ return -6; }if ((status = viClose (rsrcMgrHandle)) !=VI_SUCCESS) { /* Error Closing VISA...exiting */ return -1;} I need to transmit a command that in c looks like: int WriteCmd(unsigned char cmd, int device, int address, int numBytes, unsigned char* buffer) Can anybody tell me haw would I do that? Any examples of similar programs ?
Many thanks,
ZZippo