Thread: USB communication Via SICL


Permlink Replies: 1 - Pages: 1 - Last Post: Feb 23, 2012 5:38 PM Last Post By: hognala
terrytham

Posts: 3
Registered: 02/23/12
USB communication Via SICL
Posted: Feb 23, 2012 1:13 AM
Click to report abuse...   Click to reply to this thread Reply
Hello Master

I have a unit of U2722A.
i have installed all the necessary software (IO Libraries suite, and Measurement Manager) under Windows XP platform.
I am using Visual Studio 6 to develop the sample test program, which required to communicate with the unit.
Through to the user's guide, I can somehow open unit usb as following:

INST id;
id = iopen("usb0[0x0957::0x4118::MY51190012::0]");
itimeout(id, 5000);

and id returned 1.
Next i did was trying to write a command as following:

int z
unsigned long actual;
z= iwrite(id, "MEAS:VOLT? (@1)\n", 23, 1, &actual);

z returned as 0.
Next, was trying to read result

char abc[256]={0};
z = iread(id, abc, 20, NULL, &actual);

z returned timeout error 15,
and the char array returned empty.

Where did i missed ?
Or i've sent a wrong command ? cause i saw the USB LED blinked while sending command during debug mode.

Please enlighten me
Thank You Very Much
Terry
hognala

Posts: 126
Registered: 04/09/07
Re: USB communication Via SICL
Posted: Feb 23, 2012 5:38 PM   in response to: terrytham in response to: terrytham
Click to report abuse...   Click to reply to this thread Reply
You need to change the 3rd parameter of your iwrite call from 23 to 16. This is because you are sending 15 bytes of command MEAS:VOLT? (@1) and 1 terminating byte \n. The instrument is getting confused by the extra junk bytes that you were sending when you were sending 23 bytes.

Once you change that your program will work.

Point your RSS reader here for a feed of the latest messages in all forums