Closing a Serial Port Within Labview Without Closing All Labview Applications

Updated May 11, 2023

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full

Driver

  • NI-VISA
  • NI-Serial

Issue Details

I want to make LabVIEW temporarily give up access to a serial port so that other programs can access it, but I can't find a VI that will close my serial port. 

Solution

You can use a lower level serial VI called Close Serial Driver.vi.

In LabVIEW 5.x, this VI is found under \Labview\vi.lib\Instr\_sersup.llb. In LabVIEW 6.0, it is located under \LabVIEW 6\vi.lib\instr\Serial.llb.

If you include this VI in the application, it will allow other programs to use the serial port without having to exit LabVIEW. You can then re-access the port in LabVIEW by subsequently running Serial Port Init.vi, and Serial write.vi, or Serial Read.vi. 

Additional Information

Opening and closing serial ports in LabVIEW can also be done using VISA. This is done with VISA Open.vi and VISA Close.vi.