Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

User Com Port Interface

Hello,

I want to make a 4-button control (or pull-down menu) for choosing the COM port to open. On my computer, and with Labview 6i, I call a Visa reference, such as ASRL1::INSTR for COM 1. But, on my computer, I have only have COM 1, COM 4, and COM 5 (don't ask), and Visa is limiting my choices to the corresponding ASRL1..., ASLR4, and 5.

My application is going to be used on other computers, and I'd like to give them a a choice or Com 1, 2, 3, and 4. But, when I try to force an "ASRL2..." constant, it won't let me, since my computer doesn't have one.

Does anyone know a way around this?

Thanks,

Tom
0 Kudos
Message 1 of 2
(3,193 Views)
Tom:

The VISA I/O control in LabVIEW 6i displays only those resources that are physically present on your system and/or those that have been statically configured. When you run it on another system, the valid resources for that system will be displayed. It's not a compile time thing.

However, if you really want to make an explicit list with just those 4 COM ports, I suggest using a LabVIEW enum or ring list with the 4 strings ASRL1::INSTR ... ASRL4::INSTR. Then take that string control, typecast it to a VISA refnum, and feed it to VISA Open or VISA Configure Serial Port. Just realize that if a given computer has a plug-in serial card (for example, NI makes a 16-port 232 card) you will be making most of those additional ports unavailable to your app
lication.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 2 of 2
(3,193 Views)