LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a text string as reference for com port in a VISA serial connection

Hi
 
I am doing a basic VISA serial communication with a device over the com port.
I am going to export the VI to a MEX-file (MATLAB executable), and therefore have to connect some elements to the connectors/terminals in the VI front panel. But in order to be able to use these connections in my MEX-file, they have to be a string, numeric, or array of numerics.
 
So, my question is; is it possible to make a reference to my com port in a text string e.g. COM1 instead of the VISA resource name control? All other setup can be placed in the VI with no reference needed, I only need to define "COM1" as a text string.
 
Best regards
Simon
University of Aalborg
 
LV 8.5


Message Edited by SCMAJA on 01-07-2008 11:45 AM
LabVIEW 8.6 / 2009 / 2010
Vision Development Module 8.6 / 2009 / 2010
VBAI 3.6 / 2010
0 Kudos
Message 1 of 2
(4,802 Views)
You can use a text string as the reference.



If you use the VISA Find Resource function, it will return an array of strings which you can index in your code, and store either the index, or store the string itself. You can even use strings like COM1 and COM2, assuming those ports are available.

The challenge is when you move from one machine to another, where the serial ports may be different on the other machine.

Smiley Wink


Message Edited by LabViewGuruWannabe on 01-07-2008 06:33 AM

Message Edited by LabViewGuruWannabe on 01-07-2008 06:37 AM
Message 2 of 2
(4,783 Views)