LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compiled code ignores wait

Hello,

 

I recently put together some code to automate a task in the lab using a standard Producer-Consumer framework, where I have multiple consumers to handle various components.  In the "Hardware I/O" consumer loop, I have a state called "Wait" that just waits, based on the previously enqueued wait time (for around 1-6 seconds).  All works swell while testing the software from within the LabVIEW development environment, but the compiled code does not wait.  I didn't change anything between running it in the LabVIEW IDE and running it compiled - except for compiling the code in the project.  I am using LabVIEW 2015 32bit Windows.  I am not comfortable uploading the project here, but have included a print screen of the wait case.  Currently, I am using the MGI wait, but I did try it with the basic LV wait vi as well and had the same results.  Has anyone else experienced this problem?  I did a search within the NI forums, but wasn't able to find any threads that helped.  Any suggestions or constructive advice on how I could go about troubleshooting the compiled code would be appreciated.

 

Cheers,

Kris

0 Kudos
Message 1 of 6
(3,233 Views)

First off, your code is always compiled code. It wouldn't run otherwise. LV is constantly re-compiling every time you make a change. What you're referring to is run-time execution.

 

Have you added an indicator to the integer you're writing to the Wait node? I have a feeling you have something else that's not functioning properly with you dataflow, so your Wait value isn't being passed correctly. Trace out wherever that value is set and follow it through until it gets lost somewhere.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 6
(3,222 Views)

First try to check whether your code reaches this point or not? It can be that, for some reason (race condition?) you do not enqueue this wait state. Put a pop up msg inside this wait case, and see if it is fired or not.

0 Kudos
Message 3 of 6
(3,218 Views)

Are you sure you do not Dequeue at multiple places from the same Queue? Usually you should only Dequeue from a queue at a single place only.

0 Kudos
Message 4 of 6
(3,208 Views)

So, it ended up being embarrassingly simple to fix.  I added a dialog message box in the wait case to show the current value to help me figure it out.  The wait value was being enqueued to the loop before it was updated.  Basically, I passed a bunch of control references from one loop to the other at initialization but for some reason I was passing the value (not reference) of the wait control.  Since I only passed the initial value, it wasn't using the correct value.  The thing I don't understand is how it worked fine in the development environment, but didn't work when I ran the run-time executable.  Thanks for the help everyone.

0 Kudos
Message 5 of 6
(3,139 Views)
Yup, data flow issue. In the development environment, the initial value gets passed from the previous run. As an executable, the initial values get reset every time it opens.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 6
(3,120 Views)