LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Restart a flat sequence

Solved!
Go to solution

I have some code inside a flat sequence, and I entered the flat sequence inside a while loop. The thing is that I don't know how to restart the flat sequence, so that in the last frame, it goes back to the first frame and restarts the process until the program is stopped.

Can someone please tell me how to do this?

Thanks in advance!

I forgot to mention that I need to execute the code in a sequence, and I can't use a state machine, because my code doesn't work with user input, so please suggest another method.

0 Kudos
Message 1 of 9
(4,676 Views)

You put a while loop around the flat sequence.

 

I don't understand your reasoning for not being able to use a state machine.  I guarantee a state machine architecture is possible and would be a better implementation then a flat sequence.

0 Kudos
Message 2 of 9
(4,658 Views)

Is there a way to reset the probes programatically so that they return to a null value, when the app reaches the end?

0 Kudos
Message 3 of 9
(4,648 Views)

What probes are you talking about???

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 4 of 9
(4,636 Views)

What probes are you talking about?

 

Yes.  That would just be a final case of the state machine (clean up, shut down) that you execute right before stopping the while loop.

0 Kudos
Message 5 of 9
(4,634 Views)

I have another question:

I already tried to make the flat sequence repeat by using a while loop with a shift register, so that when it executes 1 time, the while loop is restarted.

This works fine the first 2 times, but it then stops repeating.

How can I make it repeat forever, so that when it reaches the end of the sequence, the while loop is restarted and the whole app executes in an infinite loop?

Forget about the probes, I just found the answer.

0 Kudos
Message 6 of 9
(4,626 Views)

If you want an infinite loop, then you need to wire a False constant to the stop terminal of the while loop.  I don't recommend that because even an "infinite" loop you will want to stop eventually.

 

Figure out why your while loop only ran twice.  There must have been something you did that caused the boolean value going to the stop terminal to be True after the 2nd iteration.

 

The questions you are asking are about some basic LabVIEW programming skills.

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 7 of 9
(4,617 Views)
Having an infinite loop makes as little sense as your statement that you can't use a state machine. You should do an orderly shutdown. Your while loop should not be stopping unless you press the stop button bit since you have decided not to post any code, it is impossible to say what error you have made in the program.
0 Kudos
Message 8 of 9
(4,614 Views)
Solution
Accepted by topic author Nando88

Nando88 wrote:

I forgot to mention that I need to execute the code in a sequence, and I can't use a state machine, because my code doesn't work with user input, so please suggest another method.


User input has nothing to do with whether or not you can use a state machine.  State Machines are wonderful for sequencing.

 

What probes are you referring to?


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 9
(4,607 Views)