06-28-2016 11:24 AM
I am trying to find a way to search for a specific com port through the command prompt using system exec in labview. Is it possible to get a list of com port connections much like the one you see in device manager where it will list the name of the device connected to a certain com port? I want to be able to automatically find the com port for a specific device.
Solved! Go to Solution.
06-28-2016 11:35 AM
Why are you using the System Exec? Why not just use VISA?
As far as I am aware, it is not possible to get the information about what the serial port is connected to without trying to actually communicate with it. What I did was make a routine that get the list of available COM ports and then used a FOR loop to try to write/read to/from the instrument until I got the response I wanted.
06-28-2016 11:59 AM
because it is a virtual com port that gets set up and i have tried the VISA Find Resource vi and it did not work. However, funny enough, right after i submitted this post, i found the solution to my problem. If you use system exec and type this command into the standard input:
wmic path Win32_SerialPort
This will bring up a list of all connected com ports and very quickly also. From there i can parse out the info that i don't want and widdle it down to the com port of the desired usb device.
Maybe this can help someone down the road.
06-28-2016 12:02 PM - edited 06-28-2016 12:13 PM
Here's a vi I wrote a long time ago that shows how to find all Com ports and select one using VISA.
I have had no issues finding virtual com ports using this.
06-27-2021 04:52 AM
As I am new to this software, am facing it difficult to create the vi of the attached image. Can you please send the vi of the image you have attached?
Thanks
Kaustav Sen
06-27-2021 04:59 AM - edited 06-27-2021 05:03 AM
It’s not jhst an image but a LabVIEW snippet. Click on it to open it in a sort of pop over view, then look for the download button and save it to your hard disk. Then drag it from there into an empty VI diagram.
But it’s very basic LabVIEW programming so if this code is a.challenge to recreate, you may want to take a look at the training resources offered at the top of the LabVIEW forum.