LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to ensure same COM port everytime for the LABVIEW application???

I am making a labview application which will run on the PC and can be used to control a microcontroller.  The connection between the PC and the microcontroller is serial with the USB end of the cable going to PC and the serial i.e DB9 connector going to th microcontroller.

In my Labview application which will run on PC side, I have coded to allow VISA to read from COM port 5. So serial communication between PC and microcontroller will be on COM port 5.

But my problem is that whenever I plugin the cable into different PC's the connection gets assigned a different COM port and so the application does not work on other PC's.

 

If I want to make a .exe file of my application, I must ensure that when the application will be launched on any other PC, it will work. How to ensure that the application is assigned the COM port which I have coded for in my labview application?

 

OR IS THERE ANY OTHER SOLUTION YOU COULD SUGGEST?

0 Kudos
Message 1 of 4
(2,239 Views)
Com n is just an alias so you can change the alias in MAX or use something meaningful such as 'micro' and assign that to any canonical name. You can use the VISA Find Resources or system configuration functions to get a list of available ports. Write something to each port that is found until you get a response that can can only come from your device. Use an ini file that defines the actual port. Edit the file for each station. You can change the Windows enumeration for the device.
0 Kudos
Message 2 of 4
(2,230 Views)
Hi.
Dont hard code the com port. Let the user change it and save the last value in a config file.
0 Kudos
Message 3 of 4
(2,228 Views)

I always use configuration files for instrument interfaces.  Simply for the reasons you are running into.  It is very simple up update a config file.  All your application has to do is read it and set up the VISA session.

 

Be sure to go through the Config File palette (in the File I/O palette).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,123 Views)