12-06-2010 04:41 AM
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?
12-06-2010 05:01 AM
iron_maiden09 wrote:[...]Could anyone tell me if this is possible [...]
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,
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.
12-07-2010 06:30 AM
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: http://decibel.ni.com/content/docs/DOC-7944
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. Further information about this process is given here: http://digital.ni.com/public.nsf/allkb/CB2A432E1E0
For reference, information about type def can be found here: http://zone.ni.com/reference/en-XX/help/371361F-01
If you require any additional information, please post up a reply and I will try to assist you further.