12-06-2010 04:41 AM
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
12-06-2010
05:01 AM
- last edited on
05-02-2025
07:42 PM
by
Content Cleaner
@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
12-06-2010 08:11 AM
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
12-06-2010 10:24 AM
Here is my state machine example. It has an event structure to handle front panel events. Modify as needed.
12-07-2010
06:30 AM
- last edited on
05-02-2025
07:43 PM
by
Content Cleaner
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.