LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is there a way to avoid stopping a loop for 3 times

i'm wondering how can i make my loop doesn't stop even if the condition is true ,until the 3rd time(when it's true) then it stops

0 Kudos
Message 1 of 14
(3,060 Views)
well, you could store the stop flag in a stacked shift register and only stop if the last 3 iterations were all true.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 14
(3,037 Views)

it's still a little complicated for me, if i get it right i have to add a for loop with a shift register!!!

4.png

0 Kudos
Message 3 of 14
(3,027 Views)

First, clean up your wiring.

 

Second, you don't need to add a For Loop.  You just need to use the shift register on the while loop you already have.

 

Third, you need to define your stop conditions more clearly.  Does it mean the first time the stop is true after the loop has run 3 times?  Or it must be true for 3 iterations in a row before stopping?  It must have been at least 3 times, not necessarily consecutively, before stopping?

0 Kudos
Message 4 of 14
(3,021 Views)

the loop stops in 2 cases: if i click stop or if i didn't realize the 2nd condition(in red).if i maintain a value(30) for 10 sec or more it's ok no problem.but if i maintain this value(30) for less than 10 sec the loop stops,i don't want that.what i want is if i miss to maintain for the 1st time then i had an other chance and again until the 3rd time.if i miss to maintain this value for 10 sec in the 3rd time then the loop has to stop

6_001.png

0 Kudos
Message 5 of 14
(3,008 Views)

I don't completely understand what you are saying.  It is a lot of "ifs" and also a lot of run-on sentences.  (It would help if you capitalized your sentences and put some spaces after your periods.)

 

If you want the stop button to only stop the loop when someother condition as occurred as well, then calculate the logic for that other condition and AND it with the stop button before sending it to the OR function.

0 Kudos
Message 6 of 14
(2,994 Views)
If you had implemented the state machine like you said would try when you first asked this question at http://forums.ni.com/t5/LabVIEW/how-to-restart-an-elapsed-time-3-times-inside-a-case-structure/m-p/2... you would be able to do this.
0 Kudos
Message 7 of 14
(2,993 Views)

I want to solve it without using the state machine.

 

Yes maybe it's an and/or game ,how can i use feedback node with iterations in order to make that condition repeats 3 times if it's False.

0 Kudos
Message 8 of 14
(2,959 Views)

Something like this?  BTW, I also think you should be going with the State Machine.  I makes things so much easier to understand what is happening.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 14
(2,943 Views)

Just curious... why are you so averse to the state machine?  If you don't learn this simple concept, your future in LabVIEW development is bleak.  Take the time to learn this basic concept.  It will serve you very well!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 14
(2,915 Views)