From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Executable file didn't work with multiple devices communicate using serial port

I wrote a program to communicate with several devices using RS485 protocol. The VI works, I can read-write to each devices as I wanted. However, when I build it up to executable, apparently, none of RS485 devices have communications. I wrote another VI to control one of devices, and both VI and executables are OK. It looks like the executables are unable to control multiple RS485 devices, but why?

 

I tried to install VISA run time engine, didn't solve the problem. Attached is VI that tests all devices and VI that tests only one devices.

 

Urgent, please help.

 

Thanks!

Download All
0 Kudos
Message 1 of 15
(1,260 Views)

Both VI and executable are tested on same computer.

0 Kudos
Message 2 of 15
(1,255 Views)

In your EXE, is the VISA Resource drop down list populated? I mean, can you see the list of available COMs?

 

Moreover, your first loop (the loop you use to wait the user to click Start) doesn't have a time control. You should use a Wait function.

 

Finally, put some debug indicator in order to understand if your code stucks in some points. 

0 Kudos
Message 3 of 15
(1,225 Views)

Do you mean both applications fight for the same serial port for different devices on that serial port?

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 15
(1,212 Views)

Besides missing a bunch of sub-vi's so we really can't troubleshoot it. That code architecture is so bad, the fact that it works at all in all surprises me. You have flat sequences inside of flat sequences and even a stacked sequence inside of a flat sequence inside of a flat sequence...

 

You need to go through some tutorials and understand what they mean by Data Flow programming.

 

But in general multiple devices on an RS-485 bus is nothing special unless it uses some other communication protocol like Modbus.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 15
(1,191 Views)

I have dropdown list, so call the COMs. The VI works fine. It is just the exe. I don't know how to debug exe while it is running, it is not supposed to run with Labview installed.

0 Kudos
Message 6 of 15
(1,172 Views)

The sub Vis are based on Modbus. The device sent binaries, and Labview only process ascii.

 

Anyway, it is just a code to test that my devices are under control work. The VI with multiple devices works but not the exe. It looks like Labview needs to install something for exe to work on multiple devices. I wonder if someone has the experience.

 

I just heard the multiple device exe works in my friend computer, but we don't know who ever did something extra.

0 Kudos
Message 7 of 15
(1,171 Views)

I think it is sort of like what you guessed. But I have given each of devices a address#, so that they won't fight each other. The weird thing is Vi with multiple devices works, until it has been compiled to exe. Both Vi and exe of single device works. The serial port communication is used modbus to process binary to ascii. 

 

Anyway, a friend has run the multiple device exe in his computer, it works. I wonder, I need to add something to Labview run time engine..... I just installed Visa run time engine, it ididn't solve my problem.

0 Kudos
Message 8 of 15
(1,163 Views)

Full VI (with sub Vis) are attached.

0 Kudos
Message 9 of 15
(1,154 Views)

I kind of solved the problem by accident. The executable starts running automatically when you click it. And channeltest.exe looks like stucked somewhere. But when I click stop and terminate the program, and run it with channels has be selected by last run, it works as expected. 

 

I though it might take some time to for the computer to commute to the port, so I add a frame to wait 1min after I click start. I started the program, choose the right port from port list, then click "start", and the computer will wait a minute to process next frame, still, it didn't work. Looks like the exe won't figure out the port no matter what at first run.

 

Anyone has idea how to click exe file without running it after click?

0 Kudos
Message 10 of 15
(1,113 Views)