LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupting sequence structures

Say, for example, I have a case structure with two cases. In each case, there is a sequence structure. If case 1 is true and the program is running that particular sequence, would switching to case 2 immediately cut off the sequence from case 1 and leave it incomplete in favor of executing the sequence from case 2?

0 Kudos
Message 1 of 14
(5,598 Views)

No.

 

How would the program know that it should be in case 2 until case 1 ends, the loop iterates, and it has a chance to read the condition that determines which case to execute?

 

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

0 Kudos
Message 2 of 14
(5,596 Views)

The program would know that it should switch to case 2 based on another input that is outside of the structures, like a user controlled boolean, for example. All of this would be going on inside a while loop, by the way.

 

I apologize for not adding those details earlier.

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

No.  Which case gets executed is determined by the value in the wire going into the selector terminal at the beginning of the case structure.  Where or how that value is getting into the wire is irrelevant.

 

That wire doesn't execute again, and the selector doesn't determine which case to execute until the current iteration of the loop ends, which includes all code inside that loop ending, including all code inside any internal structures such as the case structure.  Only then will the loop iterate again, the value travels down that wire into the case structure selector terminal, and then the appropriate case of the case structure begins executing.

 

This is all basic dataflow rules that LabVIEW executes, and you need to take those tutorials to begin understanding that.  Set up and example in code, then run it with highlight execution turned on and follow along.

Message 4 of 14
(5,563 Views)

you need to learn the basics of dataflow. Sequence structures need to complete, they cannot be interrupted. While the code is inside the sequence, it cannot read controls outside of it, unless that other control is in a parallel loop.

 

What you need is a state machine. This not only eliminates the sequence structures, it will also make the code logical and maintainable.

0 Kudos
Message 5 of 14
(5,559 Views)
It is suggested that not to use sequence structure unnecessarily..... it's not possible to abort in case of developing applications where emergency is major criteria

Pls mention your expected result and actual results clearly

Snap /vi attachment will be useful
0 Kudos
Message 6 of 14
(5,552 Views)

I'll have to look at the tutorial videos again. Is there a way to interrupt the sequence before it completes, by any chance?

0 Kudos
Message 7 of 14
(5,545 Views)
Three different people have said no. I'll be the fourth to say the same thing.
0 Kudos
Message 8 of 14
(5,538 Views)
No way ......
You need to have some variable and case inside sequence
variable has to decide whether case to run / not....

Here "variable" takes its value from your interrupt signal...
0 Kudos
Message 9 of 14
(5,534 Views)

@palanivel wrote:
No way ......
You need to have some variable and case inside sequence
variable has to decide whether case to run / not....

Here "variable" takes its value from your interrupt signal...

This is bad advice.  Alone, variables and sequence structures are dangerous to use if you don't understand them.  You don't fix bad architecture by making it worse.  Avoid doing something like this... ever.

 

You've been told by multiple people that you can't stop the sequence structure once it's started.  That's a general dataflow principle.  It's going to run.  The best advice you've been given in this thread is to take a look at a state machine architecture.  It's exactly what you're describing and doesn't require making your achitecture even worse to accomplish your goals.

Message 10 of 14
(5,426 Views)