Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ReadString() generates TimeOut message the second time its called...

I am trying to setup a pressure controller using the .Net 2.0 API. I setup the device as follows:

 

NIDevice = New Device(0,16)

NIDevice.IOTimeout = TimeoutValue.T3s

NIDevice.Clear()

 

 

Then I set the Pressure Controller to a pressure:

 

NIDevice.Write("R1S3U16N1P=50C1F21")

 

I query the device for the pressure in a timer every 500ms as follows:

 

MyString = NIDevice.ReadString()

 

The second time it tries to read from the device I get the  following error message:

 

"Time limit exceeded to complete operation."

 

Any ideas?

0 Kudos
Message 1 of 6
(5,033 Views)

Does the device really send the pressure data without being queried ? I guess the first time, when it works, it just responds to the setting command.  But for  the second read , you have to send a new command to get a response. Either a special query command or just resend the same setup command.  

However this is only guessing, because you did't tell us anything about the manufacturer and type of the device, you are using.

0 Kudos
Message 2 of 6
(5,025 Views)

The Device in question is a Druck DPI 520. When I use the Traditional Drivers, yes, once the device is initialized, all I have to do is:

 

Call NIReceive(0, 16, Buffer$, STOPend)

 

and the device responds back with the pressure.

 

When I use the .NET calls, I get the TimeOut message on the second attempt at reading...

 

I am in the process of talking with Druck directly to see if there is a query command I can send it. I don't see one in their Manual at all...

0 Kudos
Message 3 of 6
(5,015 Views)
Another hint, possibly. When I use your utility "NI-488.2 Communicator" and have no value in the "Send String:" box, hitting the "Query" button returns the pressure. What exactly is the "Query" button doing in this case?
0 Kudos
Message 4 of 6
(5,009 Views)

Hi,

I agree with markus, usually you need request the device to return data in order to be able to read anything. It appears that your device may return the pressure every time it is communicated with, which may explain why it returns the pressure once, when you set the pressure and again when you query with nothing in the Send String box. Your device may interpret that as a remote frame requesting information and thus the device returns the pressure. Does your device return the pressure every time you query it with anything, like the default “*ind?” ?

Regards,

Matt
Matt
Applications Engineer
National Instruments
0 Kudos
Message 5 of 6
(4,990 Views)

Ran you NI Spy utility to see what the "NI-488.2 Communicator" software was sending for the "Query" command without any data in the "Send String" box and noticed that it was only sending a NULL.

 

Tried doing the same thing in the .NET call as follows:

 

NIDevice.Write("")

 

NIDevice.ReadString()

 

and it works correctly. Thanks for all the suggestions and help...

0 Kudos
Message 6 of 6
(4,984 Views)