LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview VISA session

how do i have only one VISA session going through multiple vi using a front panel?

my VISA session keep changing instead of GPIB::20 into (1) and so forth

0 Kudos
Message 1 of 5
(2,624 Views)

You coded something incorrectly.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 5
(2,595 Views)

Well without seeing your code all we can say is "you are doing it wrong".

 

But I am guessing that you are not using a proper program architecture and that is why you are finding it difficult. 

 

Basically you should be doing this:

  1. Open a single VISA session
  2. Using shift registers pass it throughout your program reusing it as necessary
  3. Close it at the end of your program
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 5
(2,584 Views)

Don't bother attaching a picture of your code (well, you can, but you should also attach the VI or VIs in question, as they are the most useful items for us to examine -- we can tell what version of LabVIEW you are using, we can "see" all the elements of a Case structure, we can edit and run your code, etc.  Can't do any of those with a picture ...

 

Bob Schor

0 Kudos
Message 4 of 5
(2,553 Views)

The best way to learn to code is to look at well written code as an example.  Luckily NI provides a lot!

 

Open up the "HELP\Find Examples" from your VI.  Search for 34401.  This is an instrument driver that uses VISA to communicate with a Keysight DMM.  Take a look at how they pass the GPIB Instrument reference (and Error) wire in and out of the subVIs.  You should emulate this technique in your code.

 

Then on your front panel VI you can use "Edit\Make Current Values Default" to save the GPIB address of your current instrument.  This way your front panel will at least remember the address each time its loaded.

 

Hope that helps.

Craig

0 Kudos
Message 5 of 5
(2,539 Views)