LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flat sequence programming

Hi all,

 

I have a program set up in a flat sequence structure and want to include a stop button that will exit the vi at any point in the sequence. I also want to include a reset button to send the program back to a certain frame at any point in the sequence. Could anyone tell me if this is possible and how I would set it up?

 

Thanks

0 Kudos
Message 1 of 5
(3,099 Views)

 


@iron_maiden09 wrote:
[...]Could anyone tell me if this is possible [...]

 

Thanks


 

This is not possible and one of many points why you should never use sequence structures.

You are actually looking for a state machine. (please note that the code is not best looking in this example and you should use a type definition for the enums).

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 5
(3,091 Views)

Basically the same idea is to use a case structure where each or your frames = one case number, that way you can check for stop between each loop. Not the prettiest solution, but should work.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 5
(3,060 Views)

Here is my state machine example.  It has an event structure to handle front panel events.  Modify as needed.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 5
(3,038 Views)

Hi Iron maiden!

 

As norbert has pointed out, your best option is to use a state machine with a type definition enumerated control (type def enum), such as the one shown here: https://forums.ni.com/t5/Example-Code/Around-the-World-in-80-Cases/ta-p/3511817 

 

The benefit of using the type def enum is that you can add additional states to the type def and they will be automatically updated to each copy of the enum within your code. 

 

For reference, information about type def can be found here: https://www.ni.com/docs/en-US/bundle/labview/page/creating-custom-controls-indicators-and-type-defin...

 

If you require any additional information, please post up a reply and I will try to assist you further.

 

Stephen C
Applications Engineer
0 Kudos
Message 5 of 5
(3,000 Views)