LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help -- Error value not being passed between While loops

I have a LabVIEW VI that starts with an Outer While loop. See the attached JPEG results of execution highlighting. Within that Outer While Loop are two While Loops that are daisy chained together using the error data structure. That is: the VI receives the error structure as an input connector and passes it through the Outer While loop to the first of the Inner While Loops, which may modify the error data, the the First Inner While loop is wired to pass the error data on to the second Inner While loop and the second may also modify the error data before the error data is passed on through the Outer While loop to an output connector. A fairly standard error daisy chain setup.

 

The second Inner While loop also takes a second input which is a Message Queue which comes as an input to the VI.

 

The first Inner While loop includes a Case structure. The Case structure generates a 3rd output that is not wired to anything (yet).

 

The Execution Highlighting shows that the Message Queue input is sent to the second Inner While loop and is waiting there. The Execution highlighting also shows the error data makes it all the way to the error output of the first Inner While loop but is never passed on to the error input of the second Inner While loop. A probe placed on the error connection between the first Inner While loop and the second is never executed, this shows that the error data is stuck at the output of the first Inner While loop. Of course the Second Inner While loop never executes because it never receives the error input data.

 

Why is the error data never passed between the first Inner While loop to the second Inner While loop?

Why does the error data never exit the error output of the first Inner While loop to an variable or probe placed there?

How can I fix this?

 

THANKS MUCH for any assistance!

0 Kudos
Message 1 of 10
(4,167 Views)

Not shown in the picture is what actually stops the first While Loop.  It isn't stopping so the data isn't propagating.

 

Note:  You seem to be using 'Run Continuously' which should only be used for certain debugging applications, typically involving memory problems that appear after running thousands of times.  For testing like this, your VI should be configured (and it appears to be) to run once.

 

Edit:  Attaching actual code would be very helpful.  On several occasions I was trying to click on the scrollbar in your image to see what was over there....

0 Kudos
Message 2 of 10
(4,159 Views)

What do you mean by "It isn't stopping so the data isn't propagating." ?

 

Does a While loop have to stop in order for the data to pass from one While loop to the other?

 

Even if I put a Wait function in the first Inner While loop, it still does pass data to the second While loop. Shouldn't it do this when it is waiting?

 

What is the appropriate way to daisy chain the error data through multiple While loops and functions?

 

Attached is my VI.

 

Assistance appreiciated.

 

0 Kudos
Message 3 of 10
(4,138 Views)

Basic LV dataflow.  The While Loop must stop before its data passes to the rest of the VI, including your second while loop.

 

After some practice, it becomes more natural.  There are a lot of examples, and some LV tutorials.  If I were to guide your learning a bit, I suggest you learn about State Machines, a quite natural architecture for problems like this.

 

When you have studied the state machine a little bit, and are ready for the next-level type 'Action Engine Nugget' into the forum Search and read Ben's post.

0 Kudos
Message 4 of 10
(4,130 Views)

Looking at your code, I'm not sure what you are trying to do.

 

You have 3 while loops.  Do you intend to run the Message Generator after your Message Processor?  Because that is how it will run.

Some of your VI's are missing, so I do not know how / when the AMC Read will stop the first inner while loop.

 

The second loop will stop if you close the panel(?), timeout or exit.  Do you understand these?  Here is the comment inside that case.

"Intercepts the upper right close panel
operation to allow a smooth shutdown
as opposed to immediately killing the app."

Well.  I didn't see anything that would gracefull shut down the program.

 

As for the outer loop, it is hardwired to a FALSE constant, which means it will run forever, unless you click on the nasty "Abort Execution" button on the Front Panel.  That's definitely not graceful, just as closing the front panel.

 

When using an Event Structure, it is typically used as a Producer/Consumer architecture.

 

Can you describe the operation of your code?

 

 

0 Kudos
Message 5 of 10
(4,128 Views)

I forgot:

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

0 Kudos
Message 6 of 10
(4,127 Views)

What is the appropriate way to daisy chain the error data through multiple While loops and functions?

 

Do you of any tutorials that cover this?

0 Kudos
Message 7 of 10
(4,094 Views)

Does a Wait function effectively stop a While loop?

 

How do I pass data or events from inside a While Loop that I want to run forever until application termination, if the outputs of a While Loop are not sent until the While Loop is stopped??

0 Kudos
Message 8 of 10
(4,088 Views)

If you want two while loops to run in parallel, then you can't have a wire from one loop going into the other.  That means don't daisy chain the error wires through.

 

If you need to pass data between loops, then use queues or notifiers.

 

A wait statement causes a delay in a  while loop, it doesn't stop it.

 

And yes, the tutorials do cover all of this, so please work through them.

0 Kudos
Message 9 of 10
(4,069 Views)

You can merge errors (or data) from two parallel loops.

If you look at some examples, or even code templates (look under new VI and select Event Structure, you'll see how they do it).

 

0 Kudos
Message 10 of 10
(4,010 Views)