LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to release a COM Port when the vi is done

I will have a mass production of usb items, so I will program every one of the item, but after I plug another one it creates another COM port and I want to use always the same, I can't do it manually because I need a very fast production, so any cmd command or an exe will work.

 

PS. I don't know why but devcon.exe can't remove the COM Ports

Ricardo Hernandez Noguez
Test Development Engineer
Acuity Brands
0 Kudos
Message 1 of 4
(3,713 Views)

Do you use VISA Close on the serial port? Without that the COM port is still open and Windows better won't allow to remove a device that has still an open reference by some application or very nasty things could happen.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 4
(3,679 Views)

Check out the Simple Serial example in the Help >> Find Examples.  It is very basic but shows how to open, write, read, and close a serial port.  If this works as expected and released your hardware, but the code you wrote does not, then you aren't releasing it properly.

0 Kudos
Message 3 of 4
(3,663 Views)

I think you are asking about the actual COM port enumeration rather than the use of the port, correct?

 

Windows, by default will create a new COM port for your virtual device on USB if the USB serial number is different. In your case, this is likely to be the case as you are connecting to new USB devices during manufacturing to program them.

 

You can edit the registry to alter this behavior so that the serial number does not cause a new port enumeration - it will be driven purely by the PID / VID. The registry needs to be altered for the specific PID and VID of your device, see this link for an example with FTDI devices (section 3.5) - alter this to suit your case. http://www.ftdichip.com/Support/Documents/AppNotes/AN_123_How%20COM%20Ports_Are%20Allocated%20on%20D...

Message 4 of 4
(3,636 Views)