LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find serial port automaticly

Hi:
There is question that obsess me for a long time that is how can I find a serial port number of the pc automaticly.
 
when I use the advanced visa read and write vi that provided by the labview. The serial port number is presented as
 
a control and can be configured by the user.
 
But when I build the file as a .exe and the user is not familiar with the Pc(have no knowledge about the serial port).I want to
 
find the serial port automaticly by the program . How can I do it.
 
thanks for your help
 
aaa
0 Kudos
Message 1 of 5
(3,088 Views)
First, I'll assume that NI-VISA is installed on the PC because it would be needed to do serial port communications.  When you use the control, it will give a list of all the ports on the PC in the dropdown list.
 
I'm not sure what you mean by find the serial port "automatically".  If the port is available, it will be on the list.  I don't think it is much work for a user to hit the drop down button and select the port they want.  They need to have that much control.  If the computer has more than one port, how is the PC supposed to know which one to pick automatically.  Smiley Wink
 
If you have a specific com port in mind, such as Com1, you can save Com1 as a default in the control.
0 Kudos
Message 2 of 5
(3,070 Views)
HI Ravens Fan :
 
thanks for your replying;
 
I already install the NI-visa  driver. Maybe I did not express my question definitely.
 
I use some computer and find there is only one serial port but the serial number is not default to com1(ex: com2,com4 ...)
 
This situation is usually occured when using the usb to uart bridge adaptor.
 
So I want to know how can I find the serial number correctly(I want to know the only serial number is com7,com2 or com4..) and configure the visa resource name directly( do not
 
need choose by user)
 
aaa1982
0 Kudos
Message 3 of 5
(3,051 Views)
With the VISA Find Resource function, you can get a list of all resources or just the serial ports. If you then need to determine which one is actually connected to some specific instrument, then you will have send queries out each port until you get an expected response.
0 Kudos
Message 4 of 5
(3,039 Views)

Thanks Knutson

Maybe this is the answer I want to get.

aaa1982

0 Kudos
Message 5 of 5
(3,019 Views)