LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

duplicate VISA session?

Solved!
Go to solution

I have a VISA session (e.g a Serial session to COM1)

How can I determine programatically whether or not the session is open?

(I can see on the screen an Icon appears when a session is opened. What is the programatic representation of this?)

- I want to be able to open a Session if it is not already open, or use the existing session if it is (no duplicates).

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 1 of 9
(4,316 Views)
You don't need to check if open. Use VISA Open without Duplicate Flag. It will open a new session if not already open and it will use opened session if already open.
0 Kudos
Message 2 of 9
(4,311 Views)

So by extrapolation...

If I actually want to know if a VISA session is open,

 

VISA Open with duplicates = True,

If VISA out = VISA in, Session not open

If VISA out NOT= VISA in, Session already open

VISA Close session just opened.

output boolean status of Test

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 3 of 9
(4,309 Views)

Hi James,
If a VISA session is open, and you open another one while the duplicate session pin is wired to True, all subsequent sessions will be names COM1 (1), COM1 (2)... COM1 (n).
So if you’re trying to find out if VISA sessions are already open, what you have described will work. However, this KB (http://digital.ni.com/public.nsf/allkb/6A9B4BA95EFA6C22862575080064D98F?OpenDocument) also offers a solution you might find helpful, it creates an array of all open sessions.
I hope this helps, let me know how you get on, and if you have any more questions.
Kind Regards,

Dominic Walker

Dominic Walker
Cardiff University
Electrical and Electronic Engineering Student
Message 4 of 9
(4,271 Views)
Solution
Accepted by topic author James_W

... and passing that array into a comparision inside a for loop with a conditional stop and the boolean output gives me exactly what I want without open a new VISA session! Genius.

Thanks Dominic

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 5 of 9
(4,254 Views)
Then please mark Domenic's post as the solution to your question rather than your own thank you message.  You can unmark your message as the solution by going to the options menu to the upper right hand corner of your message.
Message 6 of 9
(4,229 Views)

Dear Ravens,

 

Can we do onething? Instead of telling this same story again and again for almost all newbies of forum,


Ravens Fan wrote:
Then please mark Domenic's post as the solution to your question rather than your own thank you message.  You can unmark your message as the solution by going to the options menu to the upper right hand corner of your message.

Can you or somebody please post a new thread in breakpoint forum regarding some basic things to understand in using the forum (Or something is already there????). My English is not that much good.

 

Then we can just give a link to that thread so that we don't need to repeatedly type the same story again.

 

Mathan

0 Kudos
Message 7 of 9
(4,226 Views)

I agree with you Mathan, now turning Madboy.  I believe there have been some posts either in Breakpoint or probably the Feedback forum about this topic.  And even some suggestions that people not be allowed to mark their own posts as a solution.  (However, there are some legitimate cases where that is perfectly acceptable.)  I'd have to search and dig for some of those message threads and it is too late to do that tonight.

 

I think the problem comes from the fact that the Solved? icon is right there in front of them in their message that they just posted, so they go and click it thinking that "hey, the question is solved, let's close the thread."  And they don't realize that all the messages above theirs also have the Solved? logo and that the solution is supposed to be a link to the real solution message.  (And also, a credit to the person who has most helped them solve their problem.)

 

Placing a post in about how to use the forum and basic FAQ's is a good idea in theory, but has two problems.

 

  1. New users to the forum don't usually go to Breakpoint or any of the other off topic boards until after they've been around for awhile, so they'll never see it.  Heck, it amazes me how some very basic questions are asked by new users within minutes after they first join the forum.  I think people should be using the forums and reading them for weeks to see how things work before they get around to posting their first message. 
  2. Any message thread about this topic on the Breakpoint board will eventually fall to the bottom and off the first page greatly reducing its visibility even further unless that message thread is so active that it keeps popping to top.

 

Any forum recommendations/rules/FAQ's would need to be a permanently linked page that is prominently located at the top of the boards or new posters would be forced to come across in the process of composing their first messages on the boards.  Another possibility is that a person can't mark their own message as the solution, or as a less restrictive case, they can't mark their most recently posted message as the solution so they don't see that link on the just popped up message right after they submitted it.  If they go back and post another message, even if it is just "Hey, yes that last one worked for me."  Then they would be permitted to mark their own but earlier message as the solution.

 

Right now it is too easy for the uninformed to one click their way into marking the wrong message as the solution, and their own message is not the solution perhaps 95% of the time.

 

 

Message 8 of 9
(4,222 Views)

Ravens:

I contemplated marking Dominic's post as the solution.

The Reason why I marked my post as the solution, and not Dominic's was that I put a very specific question in the first post, and Dominic gave me most of the answer required, but not the full answer.

As pointed out by Madboy, ocassionally/often new LabVIEW users search these forum's for answers, and so I added the complete code requirements for their sake and so that anyone else who didn't quite understand the first question could understand it by creating the solution.

 

This is NOT an attempt to take the credit, this is an attempt to provide a full and complete answer (which is often lacking in forum posts, and can be a struggle to work out if you haven't understood the thread completely all the way through).

 

The Credit went to Dominic with Kudos.

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 9 of 9
(4,204 Views)