12-15-2017 04:14 AM
Hi, im struggling here to try and get my VI to stop. I have a project due and im trying to take it step by step but i have come to a halt! can anyone suggest why this wont stop when i press the stop on the while loop around the program?
perhaps there is a smarted way to achieve what i am trying to do. basically tank 1 is to empty to 30% and then be filled by tank 2 to 90% capacity.
any help would be greatly appreciated, new to all this.
Solved! Go to Solution.
12-15-2017 04:34 AM
The stop button will only be read once all 4 frames in the sequence structure have finished in order
Frame 2 looks like it will take 7 seconds, frame 3, 6 seconds and frame 4, 9 seconds
Pressing stop will only therefore be acted upon after 22 seconds.
Think dataflow and use the training to learn LabVIEW Basics.
12-15-2017 04:42 AM
to make it nice for ppl trying to help, plz don't attach screenshots,
either VIs or Snippets (see Edit -> Create Snippet from Selection).
the main thing to respect is the data-flow, it defines in what order things are executed/evaluated.
things that don't have predecessors will be executed/evaluated in parallel, so there is no guarantee in which order this happens.
for your vi it will go like this
1. enter outer loop
2. evaluate stop button
3 enter sequence structure
4 enter "start-wait-loop" ... iterate as fast as possible, in each iteration evaluate start button, if true stop
5 enter "supply tank" loop, iterate for 70*100ms
6 enter "dosing tank" loop, iterate for 60*100ms
7 enter "supply tank2 loop", iterate for 90*100ms
goto 2
so only every 7s+6s+9s=22s the stop button will be evaluated (as long as start button remains true)
12-15-2017 04:45 AM
in this example, you could use a local variable of the stop button,
put it in each loop with an OR of each loops exit condition, then the inner loops will stop (after at least running once) and the outer loop too
12-15-2017 05:10 AM
Thanks for the help, much appreciated. Tried implemeting it but still no luck. keep getting the following error
'If a Boolean control has associated local variables, it cannot use latch mechanical action. The first local variable to read a Boolean control with latch action would reset its value to the default.'
frustrating, i will figure it out eventually!
@jwscs wrote:
in this example, you could use a local variable of the stop button,
put it in each loop with an OR of each loops exit condition, then the inner loops will stop (after at least running once) and the outer loop too
12-15-2017 05:30 AM
buttons have like 6 ways they can be used (3xswitching, 3xlatching),
do a right mouse on the button control -> mechanincal action -> choose a switch mode
12-15-2017 05:51 AM
Bingo!
Thank you very very much.
@jwscs wrote:
buttons have like 6 ways they can be used (3xswitching, 3xlatching),
do a right mouse on the button control -> mechanincal action -> choose a switch mode