|
|||||||||||||
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
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
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.
My Profile | Privacy |
Legal |
Contact NI
© 2011 National Instruments Corporation. All rights reserved. | E-Mail this Page
|
||

E-Mail this Page