hfettig Posted February 19, 2010 Report Share Posted February 19, 2010 I have a strange problem with an Agilent 8504B instrument. Here is what I do: Open VISA resource Clear VISA buffers Write two commands in one message (Data Format, and Send Plot Data) Read until all plot data has been received Clear VISA buffers Close VISA resource This works perfectly the first time I execute this. Sometimes it even works multiple times. Mostly though it hangs the second time I execute it. Specifically it hangs in the VISA Write command. On the instrument I can see that it is stuck in listening mode. I can wait forever and nothing happens The VISA write does not time out. When I try to close my program LV hangs. If instead I power cycle the instrument, the VISA write function exits with an error. Once I power cycle the everything works again for one time. I replaced the VISA API with the GPIB API and got the same results. Any ideas what could be happening here? Quote Link to comment
Mark Smith Posted February 19, 2010 Report Share Posted February 19, 2010 This most likely has nothing to do with VISA and the PC/GPIB controller side and everything to do with the state the instrument is left in after the last command - it's not really ready to accept another command string. I'm assuming this is a SCPI instrument (I really know nothing of this specific instrument but all of the Agilent stuff I worked with has been SCPI). If so, after you read the data, can you send an error query (:SYST:ERR? or something like that). If that doesn't work, then maybe you have to handle errors by reading the status byte and finding out if anything in the error or event queue is set. This stuff is all very specific to the instrument, so you'll have to dig through the documentation to find out exactly how the 8504B operates. That or just call a *RST command and start your entire routine from a known state every time (this would be the nuclear option ) Mark Quote Link to comment
hfettig Posted February 19, 2010 Author Report Share Posted February 19, 2010 Well, I made it work. Brute force style. I noticed that it worked every time that I ran through it in execution highlighting. So I added a 500ms delay after each VISA command and now it works fine. I am glad that this is not a time critical application though :-) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.