I'm pretty new to LabVIEW, and a complete newbie when it comes to using LabVIEW with GPIB. I've tried checking the Knowledge Base and doing a search on the board, but haven't come up with anything relevant to my specific problem.
I'm trying to write a VI to communicate with an Agilent 8564EC spectrum analyzer.
I can write to it OK, to set things like center frequency and frequency span, but when I try to read back settings, I'm running into some weirdness that I can't figure out.
Specifically, I'm trying to read back the start frequency, stop frequency, reference level and dB/division settings, displaying the results on numeric indicators on the front panel.
When I run the VI, the indicators have the expected values every fifth time. (Note that I'm trying to read back four values.)
The expected values are showing up, but not in the expected places. For example, one time the start frequency value might show up in the stop frequency indicator, and the next time in the reference level indicator.
When I try reading back just two values (start frequency and stop frequency), I get the correct results every third time. (Again, one more than the number of values I'm trying to read back.)
When reading back four values, the fifth time I get the correct results, but the tenth time the VI crashes with a general I/O error.
I'm using a slightly modified version of the "Labview <-> GPIB" example VI found in LabVIEW 8 to handle the GPIB communications, in "Write then Read" mode.
The "n+1" behavior makes me think that it's a fairly simple fix, but that I'm missing one crucial piece of information.
Do I need to flush a buffer before the first read? Reset the interface? Wait longer between the write (query the instrument) and read (read the response) statements? Put a wait between the various calls to the modified "Labview <-> GPIB" VI?
Any suggestions?
Bob Pownall