03-21-2023 08:34 AM - edited 03-21-2023 08:42 AM
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 ?
Solved! Go to Solution.
03-21-2023 08:53 AM
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.)
03-21-2023 09:21 AM
Following first solution, if I read a string from an INI file, how can connect string value to VISA resource control?
03-21-2023 09:51 AM
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.)
03-21-2023 09:52 AM
You can wire a string (example "COM9") to the VISA Resource Name input of any VISA function.
03-21-2023 10:10 AM
Great! thanks to all.