LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open VISA sessions (including duplicates)

I would like to obtain a list of open visa sessions. I found this knowledge base article which should work, however when opening duplicate sessions (e.g. "COM6 (1)") the list contains empty entries or multiple COM1 references.

 

Please try the attached vi to see the effect; on my system the visa resource name control shows COM1 & COM2 (default system ports), COM6 & COM12 (2 USB-serial converters) and LPT1 (system parallel port) at start up.

 

This is shown after opening "COM6" (3x) > opening "COM12" (4x) > opening "COM1" (1x) > closing "COM12" and "COM12 (1)"

 

VISA sessions.JPG

 

Maybe there is a way to read the contents of the drop down menu of the VISA resource control which contains all the information and is also updated automatically.

 

Any help is greatly appreciated, regards W@Work

 

 

Note: I'm using LabVIEW 2009 (32-bit) on Windows XP

0 Kudos
Message 1 of 11
(4,198 Views)

Hello,

 

Thanks for your posting here. I read your issue and tried to reproduce your problem but I unfortunately couldn't do that. I attached a 1.png foto of my system that you can see what I have in my system. 

If you open your MAX and check the serial ports, What would you see?

Can you make a screenshot and post it to me?

Besides,

I'd like to know how did you dublicate's your ports because it is not allowed to do that. In your system one port will be bounded and if you try to dublicate it, it cannot be configurated.

 

I hope tohear it from you.

 

Thanks and kind regards,

 

Hossein

0 Kudos
Message 2 of 11
(4,111 Views)

Thank you very much for your response,

 

First I'll explain the duplication: the "VISA open" VI allows for opening a duplicate session (which refers to the same port). I want to use this so I can have a separate session for writing and reading which can be locked and unlocked separately. The example I attached to my original post opens duplicate sessions when you (try to) open the same port ("COM1" for example) multiple times. 

 

Could you please try the example again selecting "COM1" as "VISA resource name", then click "Open" two times. Now you should see "COM1" and "COM1 (1)" in both lists. On my system clicking "Close" (while "COM1" is still selected) removes "COM1 (1)" from the "open sessions found" list while it should remove "COM1".

 

MAX lists ports 126 & 12 that I mentioned in my original postWhen running the example this list does not change (no "COM1 (1)" for exampleso I think this is just a list of physical portsnot the open VISA sessions

 

I think you forgot to attach the image but I guess this is the printscreen you're asking for:

 

MAX ports.JPG

 

 

 

 

0 Kudos
Message 3 of 11
(4,102 Views)

Hellom,

 

Thanks for your reply. I understand your situation with your explanation. i test what you mentioned and I couldn't see the behavior which you see. If I click on Close, it will remove COM1 and not the other ones.

I use LabVIEW 2012 with Win7. So I think it could be happend in the older version. Unfortunately I don't have the LabVIEW 2009 version.Do you have the newer version to test it with?

 

Thanks and hear it from you.

 

Regards,

Hossein

 

0 Kudos
Message 4 of 11
(4,091 Views)

Thanks for your suggestion, I'm downloading the latest evaluation version (2012 Pro) to see if it works.

 

While waiting on the download, I've rebuild the vi for an older version (8.5) which I still had on my system and guess what ... IT WORKED !?

Very strange something works on an older version and does not later. 

 

I will look into it a bit more, and also let you know whether it works on 2012 (still downloading).

0 Kudos
Message 5 of 11
(4,084 Views)

I've tried it on LabVIEW 2012 and it also does not work propperly:

 

I selected "COM1", pressed "Open" 2 times , then selected "COM1 (1)" and clicked "Close" with the following result:

 

LV2012 sessions.JPG

 

I've tried it a bunch of times and it seems to me like just the bottom element is removed from the found list.

 

I also noticed something else, I opened all my ports 2x then closed them all in the same order they were opened (the found list looks like it is correct then). Now I reopened "COM 2" (2 times) and this is what came up:

 

LV2012 numbering.JPG

 

Can you reproduce any of this behaviour? Now I know that it can work (on 8.5) I can't imagine there is something on my system that is causing this. 

 

Thanks in advance for trying

 

Regards, W

 

0 Kudos
Message 6 of 11
(4,057 Views)

Thanks for your feedback. Unfortunately I cannot see any problem in my system but I could see the first behavior too. When you open a COM1 x2 times and then try to close it, then you can see that behavior. But if you close the vi without saving and start it again, you can see that everything will work properly. I think that the serial port will be reserved for a duplicating till you close the view.

I don't know if that is a problem or not. That could be the right behavior and when you open several times of different COM ports then you need to choose anyone to can close it.

 

I hope this helps and if I can do anything else for you please don't hesitate to ask it.

 

Kind regards,

Hossein

0 Kudos
Message 7 of 11
(4,051 Views)

I tried this VI on LV 2012 and then saved it back to LV 8.6 and it behaved properly in both versions. I did not see the behavior you described.

 

I would guess at this point that you have a problem with your NI VISA installation on the PC. You could try reinstalling VISA/MAX and see if that fixes the problem.

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 8 of 11
(4,050 Views)

I've tried a repair of VISA ("NI-VISA 4.5.1") and also followed this procedure but still the problems persist in both 2012 and 2009 versions.

 

Maybe a complete uninstall and clean install will get things going, i had hoped to avoid this. I will get back to you later.

0 Kudos
Message 9 of 11
(4,030 Views)

Tools>>Options>>Environment.

 

The top setting is Automatically Close VISA Sessions.  This setting will effect the behavior of duplicate opens


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 11
(4,021 Views)