LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial comms works in VI, but not in application

Hi all, 

I am reading out a vaccum pump status in LabView. It works in the VI itself when running it in Labview, but after building the application the communication fails. The main VI has two Sub-Vis for reading and writing the data which show up in the project as dependencies, but from the VISA instrument LIB only the Init VISA VI shows up as it is used in the main VI. I can't see the Read/Write SubVIs. Is this causing the problem?

 

Thanks

Ralf-Peter

0 Kudos
Message 1 of 9
(2,895 Views)

Are you running the executable on the same computer as the source code? If not, then maybe you have not installed the NI-VISA drivers? Could you upload the part of your code that handles serial communication? 

0 Kudos
Message 2 of 9
(2,872 Views)

Hi Gregroyj,

the source code and the Executable are running on the same computer The system is Labview 2016. Is there maybe a problem with the Application builder trial license?

I have appended the VIs as ZIP file.

0 Kudos
Message 3 of 9
(2,844 Views)

DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis).

 

It appears that your instrument is using an ASCII protocol.  So use that to your advantage.  Any competent ASCII protocol uses a termination character to know when the message is complete.  So turn on the termination character, set the termination character to what the instrument uses (based on your code, it is a Carriage Return, 0xD), and just tell the VISA Read to read more bytes than you ever expect in a message.  The VISA Read will stop when that termination character is read and you now know you got the full message.

 

In your current setup, you are running into a race condition where you are trying to read before the full message is received and you are getting partial messages.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 9
(2,836 Views)

@Ralf-Peter wrote:

Hi Gregroyj,

the source code and the Executable are running on the same computer The system is Labview 2016. Is there maybe a problem with the Application builder trial license?

I have appended the VIs as ZIP file.


Use this project file, I hope it'll work.

 

0 Kudos
Message 5 of 9
(2,834 Views)

Dear Sabari,

thanks for your reply but I can't open it as your LabView version is newer than LabView2016

0 Kudos
Message 6 of 9
(2,827 Views)

Here go with LV 2016 version.

0 Kudos
Message 7 of 9
(2,799 Views)

Hello Sabari,

thanks for your help. This version works well. So, where is the difference from my attempt?

I've been working with Labview since 1995, but never had an issue like this before so I'm very interested how to solve this.

 

Thanks

Ralf-Peter

0 Kudos
Message 8 of 9
(2,775 Views)

@Ralf-Peter wrote:

Hello Sabari,

thanks for your help. This version works well. So, where is the difference from my attempt?

I've been working with Labview since 1995, but never had an issue like this before so I'm very interested how to solve this.

 

Thanks

Ralf-Peter


Do you installed NI-VISA driver?

Do you did it? >> While create an executable you've to add main VI under application properties>> source files>>startup VIs category.

0 Kudos
Message 9 of 9
(2,753 Views)