From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB Address constant shows 100's of Events

I've incorrectly assumed the 'VISA resource input' is simply a numerical reference similar to a BoardID.
 
Can someone point me to instructions on how to correctly open and close a VISA session for my GPIB instrument.  (Win2000, LabVIEW 6.1). 
0 Kudos
Message 1 of 5
(3,460 Views)
I don't understand your reference to "GPIB Address constant show's 100's of Events" but a VISA Resource Name control or constant will list all of the VISA resources on your pc. A VISA resource can be the GPIB address of an instrument, a com port, a printer port, a USB instrument, a TCP/IP instrument, a PXI instrument, a VXI instrument, etc. I suppose it's possible to have 100's of resources but that would be somewhat unusual. A GPIB resource is of the form "GPIB0::address:INSTR". Click on the arrow on the right side of the control/constant and pick the one that corresponds to the instrument you want.
0 Kudos
Message 2 of 5
(3,454 Views)

I've since realised the problem stems from not correctly closing each VISA session (jpg attached)  Exiting LabVIEW clears the list.  This came about from running a lower level VI on it's own during debug.  Normally the VISA session would be closed at the level above.

The bug i'm looking for still remains.............

I'm calling a plug-in which contains VISA commands to complete a measurement from a Vector-Network-Analyser (VNA) using a plug-in architecture to support a change in instrument.  The measurement sequence involves a number of calls to the plug-in, for example, for TTL trigger single-point measurement, the sequence is VISAwrite, VISAdiscard events, VISAenable event, VISAwrite, TTL Trig, VISAwait on event, VISAread stb, VISAdisable event, Data Read.  For sweep measuremnts, gpib trigger etc, I call the same plug-in but select different cases from the plug-in to construct the desired sequence.

I've test harnessed all possible sequences without the plug-in reference structure, by simply chaining all the commands together in one long line....................and they all work fine.  However, in my main application, if I select one sequence and run the test, all is fine, but when I switch to another sequence, i receive an error when VISA discard events executes (error -1073807346) (The given session or object is invalid).

My next step is to try opening and closing the VISA reference each time a test is requested, instead of openeing it when the software is started and closing the VISA session when the user exits.

Any further thoughts would be appreciated. 

 
 
0 Kudos
Message 3 of 5
(3,441 Views)
I'm not sure that your problem is with the VISA open/close but with a mismatch in the enable/disable events. You might try doing an enable event at the very beginning and the disable event at the very end and remove the discard event at the beginning or at least put it right after the enable event. The other thing that you could try is getting the latest version of VISA. I'm not sure about events but with older versions you had to have a a close for every open but newer versions are a bit smarter. If you try to open a new session for an instrument with an already open session, VISA will just use the already existing one.
0 Kudos
Message 4 of 5
(3,431 Views)

Attached is some example code for the measurement sequence.  The general idea is:

  • initialize Instrument for a measurement
  • discard any previous unwanted events from previous measurement(s)

  • Trigger measurement, and request notification that measurement has finished

  • wait on event (wait for measurement to complete)

  • discard event (as I've been notified that the measurement is complete)

  • read data

I've experimented with different combinations using VISAopen and VISAclosed, with the open/close both inside and outside the loop.  So far all combinations result in a VISA session appearing below the bar of the resources menu shown in the .jpg posted earlier (1 entry for every iteration of the loop).

I'm using V3.0 of VISA, but I don't want to change as it may adversely effect other LabVIEW .exe applications I use on this PC.

0 Kudos
Message 5 of 5
(3,406 Views)