LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Application builder -- how to select VISA/serial port for executable

I have one PC with LabView installed, for creating executables/applications.
These applications run on a different machine without full labview, but with labview runtime engine.
 
 I have several serial ports (RS232) via USB to serial converters.
 
The problem is:
The options for serial forts available on the main PC do not match the ones on the machine running the executable.
E.g. when creating the application, I have options of com11, com12, com13;
on the target machine running the executable, only com1, com3, com4, com5;
 
How can I build an application that automatically accesses the right serial port?
 
It seems that the application does recognise the ports available on the machine it is running on, so I can choose the correct port once the labview application is running.
Unfortunately, this is not an option in my case - I need the application running as a scheduled task at computer startup, so the correct serial port needs to be set from the beginning.
It is data acquisition at a remote site, and the system needs to start up automatically after power failure, without manual setting of any parameters.
 
I appriciate any help on this.
 
Thanks,
Regards,
Stepan Leinert
0 Kudos
Message 1 of 8
(3,950 Views)
You've got a couple of options. One thing to do is when starting the app, first do a VISA Find Resource and search for all the com ports. If the instruments connected are unique and you can identify which is connected by doing a query, then you could go through all com ports found until you find which one is connected where and pass that information on. Another thing is to make use of VISA aliases. The actual VISA resource name for Com1 is actually ASRL1::INSTR. Com1 is just an alias that you can reassign in MAX. You can assign the aliases Com1, Com2, Com3, etc to the actual com ports on your system so that it matches the destination pc. You can also assign meaningful names to the com ports. You could call your com port 11 the name instrument_1 for example, and on the destination machine, com 1 could also be called instrument_1. The VISA alias names are contained in \VXIpnp\WinNT\NIvisa\visaconf.ini. You could distribute a modified version of this file to the target machine if you don't want to modify the aliases manually. The first option works well if you don't know which instrument will be connected to which port on the target machine. If you specify the instrument x is to be connected to a certain com port and instrument y to another, then the second option will work fine.
Message 2 of 8
(3,944 Views)
For a quick fix, you could set the defaults to COM1, COM2, etc when you make the app on the computer that has labview installed.  You would have to change the defaults in order to run the VI on the development machine to COM11, 12, but then the correct com ports would be set up on the remote mahince once the app was built.

Kenny
Kenny

0 Kudos
Message 3 of 8
(3,942 Views)
Thanks for the quick help, I'll try what you suggested.
Thanks - Stephan
0 Kudos
Message 4 of 8
(3,921 Views)

Make the COM port a commanbd line argument.

 

Bob

 

0 Kudos
Message 5 of 8
(3,237 Views)

@BobHorn wrote:

Make the COM port a commanbd line argument.

 

Bob

 


And/Or read the port settings from a configuration file.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 8
(3,231 Views)

@BobHorn wrote:

Make the COM port a commanbd line argument.

 

Bob

 



Why the replies to a 7 year old message thread?

0 Kudos
Message 7 of 8
(3,218 Views)

Obviously didn't look at the date. Was too involved with my own problem.

 

Sorry,

 

Bob

 

0 Kudos
Message 8 of 8
(3,203 Views)