Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

timeout during receiving data

Hi Scott

Yes, the timeout in the screenshot was ~ 100ms but I had the same results with other timeout settings later. Only if I set the timeout very high ( > time to get the result) it works perfect. But unfortunately only for this device. All other devices did not work any more with this setting. They work perfect and fast with 100 or 300 ms.

The code you asked for looks like this:
ieeeDevice = new Board(0);
ieeeDevice.IsSystemController = false;
ieeeDevice.TerminateReadOnEndOfString = true;
ieeeDevice.PrimaryAddress = new Address(Convert.ToByte(5)).PrimaryAddress;
ieeeDevice.IOTimeout = TimeoutValue.T300ms;
...
while (online) {
    ...
    String buffer = ieeeDevice.ReadString();
    ...
}

At the moment I added a selection the user can choose the timeout. But this has a bad impact. If the timeout is e.g. 300 seconds and the user wants to change a setting, he has to wait until the timeout shows up because the read thread blocks until the ReadString() method comes back. Even if I try to kill this thread, the ReadString() method does not come back. This is not very nice for the user because it looks like the application crashed.

Scott, can you see any problems in my code?
0 Kudos
Message 11 of 15
(1,541 Views)

I didn't realize it but it looks like you're doing a device-side program rather than a controller side, meaning that you're not actively controlling the bus but are merely responding to various talk/listen (read/write) commands from other instruments.  Am I right?

Can you tell me more about your entire setup?  Do you have other instruments on this bus?  Is this device an instrument? Are the other instruments also NI-488.2 based with PCI-GPIB cards in them?

Scott B.
GPIB Software
National Instruments

Message Edited by ScottieB on 07-26-2005 05:03 PM

0 Kudos
Message 12 of 15
(1,537 Views)
Hi Scott,

you are right, my device is not the master. The measurement device (IC tester) is the master, and I'm listening for its results. The start of the test will be passed by Serial Polling from my device to the measurement device (which works perfect). After that I wait for the end of the test that is passed as a String to my device.
On the bus there are only the measurement device and my device (direct connection). Unfortunately I do not know what card is inside the tester but from the documentation we know it is an IEEE 488.2.

Scott, do you think the device in the tester does not work correct?
0 Kudos
Message 13 of 15
(1,531 Views)
I think your problem stems from an architectural issue in your program.  Rather than constantly reading in a loop, why not try doing this:
 
while (true) {
Board.Wait(4) //will wait for board to be addressed as a listener
Board.Read     //then do the read
}
 
My C# code may not be exact, but that's the general idea.  For your read, you'll need to increase the timeout to something higher than your current setting to make sure you get all your data.
 
See how that works.
 
Scott B.
GPIB Software
National Instruments
0 Kudos
Message 14 of 15
(1,524 Views)
Hi Scott,

sorry for being so quite this long time. Lately I had the chance to test your
code at customer side - where we had the problem - and it worked well.

Thanks a lot for your support!!!

0 Kudos
Message 15 of 15
(1,476 Views)