LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in double while loop

Hi,
 
I'm having a problem using double while loop.
 
I put my program in a while loop where the condition is set to:" continue if true".
 
this while loop is put in another while loop(as i want the user to interact with the program). The outer while loop is set to constant false and condition stop if true.
 
i'm having a problem as i'm unable to display the result.
Please help me.
 
Attached is the diagram. I'musing llabview 7.0.
 
Thanks.
0 Kudos
Message 1 of 7
(3,412 Views)
Hello aaz,


Place your indicator in the outer while loop, this will show you the result.
Place a wait function in the outer while loop to decrease the processor load.
Maybe replace the false constant by a STOP button indicator, to be able to stop the application garcefully.

Kind regards,

andre.buurman@carya
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 7
(3,407 Views)
Hi aaz,
 
The reason your program never displays the result is because it will never stop the outer loop and proceed with sending the value to the indicator.
 
There doesn't seem to be a reason for the outer loop.  Why do you have one? 
 
As for the inner loop, it will only execute once if the control has a value other than 4.  If it is 4, then it will run forever.  Avoid such a scenario. 
Actually, avoid scenarios which would keep a loop running foever, which is the case for both your loops.
 
Here is the reason you gave for the dual loop:  "this while loop is put in another while loop(as i want the user to interact with the program). The outer while loop is set to constant false and condition stop if true."
 
I do not see any user interaction in the inner or outer loops.  What type of interaction did you want to implement?  For instance, a stop button?
If you read the last sentence in blue above...  you have a constant of false and the stop condition to true..  The loop will never stop.  What did you have in mind for this outer loop?  Why a loop that will never stop??  It must freeze or slow down your PC, since there are no "Delay" functions in the loop.
 
Let us know what you are trying to achieve and we can provide more appropriate advice. 
 
RayR
 

 
Message 3 of 7
(3,387 Views)
Hi,
 
This is a simplified version of my program.
 
All i want to do is to allow the program to run all the time and change the value of the result immediately when the user key in a number (without having to press the run button again). I hope you understand. Sorry for the confusion.
 
Thanks.
0 Kudos
Message 4 of 7
(3,357 Views)
This example using an event structure will meet your requierements in a very efficient way. Add the comparison if needed. The mechanical action (right click on the button >> Mechanical Action) of stop  must be set to Latch when Pressed or Latch when Released. Let us know if you need further help.
Message 5 of 7
(3,335 Views)

Hi,

Can you save it in version 7.0, as i am unable to open it.

 

Thanks!!!

0 Kudos
Message 6 of 7
(3,332 Views)
Message 7 of 7
(3,327 Views)