LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timeout expired on visa read

I've created a program that closes channels 101-104 one at a time on the Keithley 2700, measures the DC voltage and reads it back into the program. However, I consistently receive a timeout expired error in the middle of the program causing no data to be received.

 

However, i've found that if I step through the program the VISA read consistently works. I've tried increasing the timeout to 5ms and implementing a 1 second time delay between each read but it still makes no difference. Is there any known reason and fix for this problem?

0 Kudos
Message 1 of 6
(3,611 Views)

It looks like you are misunderstanding the "return count" of the VISA Write and the VISA Read.  The VISA Write returns how many bytes were sent.  The VISA Read is a desired number of bytes to read.  I seriously doubt you will get the exact same number of bytes back that you wrote.  The SCPI command structure does not work that way.  For the VISA Reads, use a constant to say how many bytes you expect to be returned.

 

Also, 5ms is very short with bus communications.  The default timeout should be 10 seconds.  I didn't see anywhere that you were configuring your bus.  What type of bus are you using?  GPIB?  RS-232?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(3,596 Views)

And if you had used Help>Find Instrument Drivers to install the NI Certified instrument driver for the 2700 and just looked at it, you would not have made such an elemental mistake. Why did you decide to write your own code instead of using the existing driver?

0 Kudos
Message 3 of 6
(3,591 Views)

It's a piece of a much larger program (about 30 different vi's) so the timeout is done elsewhere. Sorry, that was unclear. Also, the read always worked when I stepped through the program so I never assumed that the byte count was the issue. In fact, when I added a 2ms time delay between the read and write, the issue seemed to be fixed and the data came out properly. However, an overflow error does seem to be showing up on the 2700 monitor. Is this a result of a poor byte count?

 

As for the right-click -> find instrument drivers spoken of, I have no idea what that is (first program using vi's) so i'll look it up. Anyway, its a piece of something larger that needs an easy to understand user interface so I figured it'd be easier to implement myself

0 Kudos
Message 4 of 6
(3,573 Views)

The read will work when your write count is greater than the expected return count. When it is not, then you will get a timeout error since the read does detect the termination character. For GPIB, it is EOI that is expected. The instrument could show an error because there are unread bytes. Depends on whether you are using GPIB or serial. If you would read the error queue in the instrument (in the driver) you would have more information. You could also be causing a query interupted error.

 

And it is not a right click option to get the instrument driver. The user interface should have nothing to do with using already written and debugged code.

0 Kudos
Message 5 of 6
(3,569 Views)

Oh, sorry, i've tried using the help->find instrument drivers before and it simply caused all of labview to crash (or at least stop responding until I shut it down). I tried it a couple times before just giving up and creating my own.

0 Kudos
Message 6 of 6
(3,546 Views)