01-15-2013 08:46 AM
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?
01-15-2013 09:53 AM
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?
01-15-2013 10:02 AM
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?
01-15-2013 10:59 AM
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
01-15-2013 11:13 AM
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.
01-15-2013 03:03 PM
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.