LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

If/Else analogy for labview

flat sequence.JPG

So I'm sure I'm going to get some criticism for the flat sequence, but if I don't have to change the fact that I use the flat sequence and can get the desired results with it still in there, then it will save me a lot of reprogramming.

 

Anyways, my program takes a bunch of measurements, but my multimeter, the Keithley 181, tends to have issues sometimes with cycling relays giving bad data.  The easy fix for the keithley is to just give it a good whack in the right spot, but I've got to pause my program (which is easy with a dialog to the user) but also to restart the current measurement.

 

So my question: If the boolean indicator in the diagram is true, i want my program to restart back at frame 1 of the flat sequence, if its false, then it can just keep on going.  If I need to use a state machine to get this result then that is what I am going to have to do, but if I can do this with the flat sequence then it will save me a lot of headaches.

 

0 Kudos
Message 1 of 5
(6,144 Views)

Your question is a classic state mashine question.

you need to implement a state amshine with at while-loop and a case structure.

 

The hole point in the sequence structure is that is can only go one way, and that is forward, taking one frame at a time. It CAN'T jump in frames, not forward, not backward. 

Message 2 of 5
(6,142 Views)

The use of state machines has been suggested to you before....

 

Application Design Patterns: State Machines

0 Kudos
Message 3 of 5
(6,131 Views)
0 Kudos
Message 4 of 5
(6,120 Views)

Yes, a state machine as has been mentioned already is basically your best option. You have discovered one of the reasons sequence structures are not widely recommended. They are inflexible constructs. Once you get inside it you MUST always execute every frame and cannot control the flow. Nor can you go back. Think of a sequence structure as jumping off a cliff. Once you jump you only have one way to go. The best you can do with a sequence structure is putting a bunch of case statements in each frame to control stuff but then that gets real ugly, real fast.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 5
(6,117 Views)