LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI exported to EXE can't read com port

Solved!
Go to solution

An application I created in LabView 2012 to read incoming serial data cannot see the com port when I export it as an exe and run it on a different machine.

 

The machine I created it on is running Win7. The machine I transfered the exe to is Win10. I installed the LabView 2012 Runtime Engine on the new machine without issue. The application reads from a serial port using VISA Read, parses data, and displays it. When I open the exe it loads with no problem, but when I run the application it cannot find the com port for the serial data. I look in the device manager and I see the com port that I need to select, but in the dropdown menu for my application, which usually contains the necessary com port, it shows nothing but the default "COM3" value.

 

When I created the exe, I transferred everything that was in the "build" folder over to the new machine. Do I need to transfer some other (VISA Read?) functionality too?

0 Kudos
Message 1 of 17
(6,326 Views)

What are you using to fill that dropdown box ?

0 Kudos
Message 2 of 17
(6,313 Views)

@nyc_(is_out_of_here) wrote:

What are you using to fill that dropdown box ?


VISA Configure Serial Port. See pic below. It's like the "Port" input isn't seeing the com port:

 

visaserial.jpg

0 Kudos
Message 3 of 17
(6,300 Views)

You answer makes no sense.

 

You configure a COM port only after you know that it exists.

 

.

0 Kudos
Message 4 of 17
(6,276 Views)

My answer makes perfect sense.

 

  1. I plug serial cable into PC, PC recognizes it and assigns com port
  2. I open up Labview VI, active com port is automatically listed in drop down, I select it.
  3. I press run and VI retrieves and parses incoming serial data with no issue.

Then I export the VI to EXE and put it on a different machine. Step 1 happens no problem, I can see the correct com port in the device manager. But when I do step 2, there is NO active com port listed in the drop down for me to select.

0 Kudos
Message 5 of 17
(6,253 Views)
Solution
Accepted by topic author lavadisco

@lavadisco wrote:
[..] The machine I created it on is running Win7. The machine I transfered the exe to is Win10. I installed the LabView 2012 Runtime Engine on the new machine without issue. [...]

When I created the exe, I transferred everything that was in the "build" folder over to the new machine. Do I need to transfer some other (VISA Read?) functionality too?


Did you install VISA Device Driver (VISA Runtime) ?

0 Kudos
Message 6 of 17
(6,246 Views)
Solution
Accepted by topic author lavadisco

Hi lavadisco,

 

Then I export the VI to EXE and put it on a different machine

Did you create an installer for that EXE?

Did you install VISA on the other computer?

Did you do any error handling in your program? Did you get errors?

How does your user select the COM port when your EXE starts up? The COM port is read immediately at start of the EXE (guessing from your image)…

Best regards,
GerdW


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

I did not create an installer for the EXE, I just grabbed everything that was in the builds folder after generating it and copied it all onto the new machine.

I did not install VISA on the other computer, I guess I assumed all of that would be packaged up with the EXE that I exported. I will install VISA runtime. I see the Version 15 on the NI site - is that the correct one to install or should I install an older one since my EXE was created in LV 2012?

I do get a VISA error when I run the exe, I'm away from that machine right now so I can't quote the exact text of the error.

When the EXE starts up, there is a com port dropdown that always contains a default COM3 entry in it, regardless of what the active com port is. When the user clicks on the dropdown, there are two other entries - LPT1 printer port and also the active com port. You must then select the active com port. It doesn't find it automatically. It's not a big deal that the user has to do this because there are also some other things they have to configure in the interface before running the exe.

0 Kudos
Message 8 of 17
(6,226 Views)

@lavadisco wrote:

I did not create an installer for the EXE, I just grabbed everything that was in the builds folder after generating it and copied it all onto the new machine.

I did not install VISA on the other computer, I guess I assumed all of that would be packaged up with the EXE that I exported. I will install VISA runtime. I see the Version 15 on the NI site - is that the correct one to install or should I install an older one since my EXE was created in LV 2012?

I do get a VISA error when I run the exe, I'm away from that machine right now so I can't quote the exact text of the error.

When the EXE starts up, there is a com port dropdown that always contains a default COM3 entry in it, regardless of what the active com port is. When the user clicks on the dropdown, there are two other entries - LPT1 printer port and also the active com port. You must then select the active com port. It doesn't find it automatically. It's not a big deal that the user has to do this because there are also some other things they have to configure in the interface before running the exe.


When it comes to drivers, you need to package them, along with the exe, in an installer. Also, if com ports are physical ports, they will always show up on your PC. That doesn't mean something is necessarily connected to it at the other end. Finally, you can put your code in a loop with an event structure and initialize your com port only when the user selects it from the drop down, rather than immediately at startup

0 Kudos
Message 9 of 17
(6,223 Views)

@GregFreeman wrote:


When it comes to drivers, you need to package them, along with the exe, in an installer. Also, if com ports are physical ports, they will always show up on your PC. That doesn't mean something is necessarily connected to it at the other end. Finally, you can put your code in a loop with an event structure and initialize your com port only when the user selects it from the drop down, rather than immediately at startup


  • How do I package drivers with the EXE in this case?
  • Com port assignments come and go in the Windows device manager as devices are plugged and unplugged. Any other discussion of whether they are physically present or not is irrelevant here because a com port will only register in my VI if it has registered in the Windows device manager.
  • I don't want to put my code in a loop, I don't want to modify it at all. I just want to understand what else I need to package with my EXE or what further runtime engines I need to install to make it work as-is.
0 Kudos
Message 10 of 17
(6,209 Views)