02-01-2024 10:58 AM
Hi,
i will work with a label printer. It is connect over usb. In LV environment it works. When i build exe for a target, the application does not work on it.
Resourcename is copy from NI MAX
02-01-2024 11:29 AM - edited 02-01-2024 11:30 AM
Is your development environment closed? It doesn't need to be, but if a VI opened a reference and didn't close it properly, another application (like the exe) won't be able to open a reference.
If MAX opened the reference it might claim the resource too.
02-01-2024 11:34 AM
Are you running the EXE on the same PC as the one it works in the LV environment on, or a different PC? If it's a different PC, is it also a different printer? Since the serial number of the device is part of the USB RAW VISA string.
Can you try putting a "VISA Find" in the application, to see what resources it does see in case it's different there somehow?
02-05-2024 06:34 AM
The exe is running on a different pc then the LV environment.
02-05-2024 06:36 AM
The exe is running on a different pc than the LV environment, but the printer is the same. Develop on the LV environment --> exe run on different pc
02-05-2024 08:41 AM - edited 02-05-2024 08:42 AM
Have you checked the VISA name in MAX on the PC which is running the EXE? (2nd question: do you have MAX installed on the latter at all?)
02-05-2024 08:48 AM
@SeppR wrote:
The exe is running on a different pc than the LV environment, but the printer is the same. Develop on the LV environment --> exe run on different pc
It's probably NOT the same printer - at least to VISA. It's probably better to assign the same alias to the printer in MAX on both PCs and use that instead of the VISA resource. Probably the printer has different VISA resource names on each PC.
02-05-2024 09:19 AM
On the pc which is running the exe i have install VISA runtime but not MAX.
02-05-2024 10:09 AM
@SeppR wrote:
On the pc which is running the exe i have install VISA runtime but not MAX.
Well, I guess this is a problem, your printer might got a different VISA name under the other PC.
I would assign a proper alias name to the printer. Why would you refer to it as USB::0... whatever if you could simply call it as "Printer". Then I would install MAX on the second PC and assign the same alias to the printer.
Alternatively - as others suggested - you can list the visa names of the second PC and write your program smart enough to select the right one for you automatically, but personally I'd definitely go with the first one.
02-05-2024 12:05 PM
The problem is actually a little more involved than most of you guess. A USB Raw VISA resource is a low level USB resource that needs to be installed on a computer. VISA does not automatically get access to all USB resources. Instead you create an INF file in the VISA driver wizard and that INF file "installed" (really assigned) the VISA USB driver as driver for this device.
You need to have NI VISA Runtime with USB support installed and run the VISA INF file for that device on the according computer. On Windows 10 systems the according INF file needs to also be signed with a certificate in order for this to work. Not sure if the default VISA Runtime installer has all the provisions for this to work.