LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rookie errors

Solved!
Go to solution

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.

0 Kudos
Message 1 of 7
(3,082 Views)

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. 

 

0 Kudos
Message 2 of 7
(3,072 Views)

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)


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 3 of 7
(3,066 Views)

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


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 7
(3,063 Views)

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


 

0 Kudos
Message 5 of 7
(3,044 Views)
Solution
Accepted by topic author Newton1878

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

 

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 6 of 7
(3,037 Views)

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

 

 


 

0 Kudos
Message 7 of 7
(3,025 Views)