LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RS 232 PORT - SCANER

I look for a function that allows the user when the program is running scans all the different ports COM that exist in a machine and can show them into a list, so that the user takes one to use it.
 
What adjustment in CVI can do that?
 
I would apreciate your valuable help!
 
Thanks!
0 Kudos
Message 1 of 5
(3,463 Views)

Hello jorgeluis…

I do not know a "direct" solution to your question. But I have my own way of doing it.

You can -in a loop for example- call OpenComConfig for ports from 1 to 32 (or another limit that gives you confidence that you covered all possible port numbers). Then, record the port numbers for which the function returned successfully. These are ports that you have on your system.

You may want to call CloseCom after successfully opened port if your code opens them later when needed.

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 5
(3,455 Views)
Another option is to use VISA functions to scan for system resources: this has the advantage of returning immediately the available resurces without need to run through all the steps of the loop. Look at bilald answer to this thread.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 5
(3,449 Views)

Thanks to Roberto and Bilal for the "real" solution.
I do not need my workaround anymore 🙂

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 5
(3,443 Views)
That is a good idea, I will implement it into my project and then i'll give you the results. Thank you ebalci and Roberto Bozzolo, I really apreciate your answer.
0 Kudos
Message 5 of 5
(3,422 Views)