LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Free comm port manually

I am debugging a program that communicating through my serial port.  Since I am debugging, many times, I need to stop the program before I close the comm port in the program.  Is there a way to manually free up the comm port?  Thanks!

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 14
(4,395 Views)

Create a simple VI that has the VISA Close function and the VISA resource as a control.  Set the VISA control to be your com port.  Hit the run button.  It will close the port.

 

0 Kudos
Message 2 of 14
(4,389 Views)

You could also temporarily turn on the "Automatically close VISA sessions" option in the "Environment" section of the LabVIEW options. I say temporarily because if you do a lot of work with instruments, having this on is a real PITA.

Message 3 of 14
(4,379 Views)

While Bill's method WILL WORK there is another easy way to accomplish this.

 

From Tools>Options select Automatically close VISA sessions.  With this set when a vi stops or is stopped any VISA resources are released

 

20637i6D5E02B1E6B0048F

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

20639iE8C1532B8F16C9BF

 

To demostrate the functional differance run the snippet above and attempt to open the same com port with hyperterminal.  With the option set and the VI Paused at the break hypertermnal will report the resource is in use.  Aborting the vi releases the resouce just as if the VISA close executed.  Uncheck the option and the behavior reverts back to holding the resource open untill the close function does run.


"Should be" isn't "Is" -Jay
Message 4 of 14
(4,369 Views)

Thanks all.  Why is the automatic close option a pita if I use comm a lot?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 14
(4,360 Views)

With the option OFF the sessions remain valid and you can run sub-vis that use the sessions without needing to add a open session in the sub-vi.  Often this is an aid to debugging GPIB commands and such nasty things as writing drivers for equipment with  user manuals that have ambigeous command syntax.  Knowing the behavior of this option (like 95% of your ini settings) can save some valuable time.


"Should be" isn't "Is" -Jay
Message 6 of 14
(4,354 Views)

That's not much of problem as long as you are using a version of NI-VISA from the past several years. The VISA Open is now optional. If a session is not open, one will be automatically created by any VISA function. I think that is why the open and close functions are on the Advanced palette.

0 Kudos
Message 7 of 14
(4,345 Views)

 


@Dennis Knutson wrote:

That's not much of problem as long as you are using a version of NI-VISA from the past several years. The VISA Open is now optional. If a session is not open, one will be automatically created by any VISA function. I think that is why the open and close functions are on the Advanced palette.


Yeah but, I do sometimes work with 6.1 Smiley Sad

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 14
(4,341 Views)

Sorry. That's cruel and unusual punishment.

Message 9 of 14
(4,334 Views)

We didn't think so when "6i" came out! Smiley Wink 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 10 of 14
(4,326 Views)