05-11-2012 05:59 AM - edited 05-11-2012 06:00 AM
Hello,
I have made a very large labview suite. The description of the suite can be simplified so that their are three main loops. These are:
1. The principal while loop.
2. A while loop which updates indicators on the front panel.
3. A while loop which checks for the stop button being pressed.
The .vi isn't perfect since there is no way of the while loops 2 and 3 ending. What is the best way for me to end loops 2 and 3 when the end of the program is reached. ie report variable (data acquisition is complete) is reached.
05-11-2012 07:54 AM
Some good practise certainly, but I find this part below really weird unusual.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 08:10 AM
I believe it is Ed Dickens who sports the signature;
"Using the stop button to stop your VI is like using a tree to stop your car. It may be effective but you may not like the consequences."
I believe you can answer your own question if you turn on execution highlighting (the light bulb) (after getting rid of that stop thingy) and watch the code while asking the question "What knows about the stop and what SHOULD know about the stop?".
Ben
05-11-2012 08:10 AM
Yeah, that is a very brute force way to stop your code. Just put the STOP terminal in your main while loop and OR it with the existing boolean there.
05-11-2012 08:26 AM - edited 05-11-2012 08:26 AM
And I also see one while loop is running without a time delay. This would eat all your CPU usage and aslo the loop is stopped by a value from the shared variable (Am not sure where it is written) suppose if the loop stops but the rest of the loops will be keep on running so the FP will seem to be hanged you need to avoid this and sychronize the loops.
05-11-2012 08:28 AM
@Ben wrote:
"Using the stop button to stop your VI is like using a tree to stop your car. It may be effective but you may not like the consequences."
I like the image!
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 08:33 AM
The lower left loop is unnecessary, you destroy the event after the main loop which is sufficent. Move the stop button inside the main loop, use a local of it to stop your global update loop, and for the love of Nurgle, place a wait in the global update loop (100ms?)
/Y
05-11-2012 08:53 AM
Hello Yamaeda,
I need the .vi to stop at the very end. (ie after the Report Variable and error out at the very right of the .vi.)
How can I do this by creating a local stop variable from the main while loop?
Nevica
05-11-2012 08:58 AM
The VI will stop once data has passed through all wires, so the VI will wait until the report is written.
/Y
05-11-2012 09:01 AM
Hello Yamaeda,
You are wrong in saying that the left lower while loop is destroyed after the main while loop finishes. It does in fact continue along with the right lower while loop. That is the problem.