LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set COM port in VISA serial

Solved!
Go to solution

Hi, I need to get a barcode from a RS232 barcode reader and I want to use 'VISA configure serial port' to set my com port. All is ok but I would like to know if there is the chance to set port number externally from my application . In my case I have installed barcode reader driver using USB port, setting driver to COM9 and in my application I've created 'Visa resource name' assigning COM9.

I want to have the possibility to change Com port number, without rebuilding my application, but setting com number in use in some INI file or registry key.

How can I do to set 'Visa resource name'  dynamically ?

Download All
0 Kudos
Message 1 of 6
(2,290 Views)

Hi sorin,

 


@sorin1 wrote:

I want to have the possibility to change Com port number, without rebuilding my application, but setting com number in use in some INI file or registry key.

How can I do to set 'Visa resource name'  dynamically ?


You can read a key from an INI file and use that information to access your COM port.

You can also allow the user to select the COM port using an UI with a string or VISA resource control.

You can search for available COM ports using VISAFindResources.

 

And maybe you can configure your barcode reader to act as an additional keyboard, so you don't need to fiddle with COM ports at all. (Well, there are both advantages and disadvantages for keyboard vs. serial port.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,277 Views)

Following first solution, if I read a string from an INI file, how can connect string value to VISA resource control?

0 Kudos
Message 3 of 6
(2,257 Views)

Hi sorin,

 


@sorin1 wrote:

how can connect string value to VISA resource control?


You can wire the string directly to VISAOpen instead of a VISA reference…

 

(VISA controls also accept strings.)

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,241 Views)
Solution
Accepted by topic author sorin1

You can wire a string (example "COM9") to the VISA Resource Name input of any VISA function.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 6
(2,239 Views)

Great! thanks to all. 

0 Kudos
Message 6 of 6
(2,234 Views)