NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
iron_maiden09
Posts: 3
0 Kudos

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

Trusted Enthusiast
Norbert_B
Posts: 3,563

Re: Flat sequence programming

 


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

Active Participant
Yamaeda
Posts: 1,788
0 Kudos

Re: Flat sequence programming

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

LabVIEW 8.2 - 2012
"Only dead fish swim downstream"
"My life for Kudos!"
"Dumb people repeat old mistakes - smart ones create new ones."
Trusted Enthusiast
tbob
Posts: 4,070
0 Kudos

Re: Flat sequence programming

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
Member
Stephen C
Posts: 120
0 Kudos

Re: Flat sequence programming

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/CB2A432E1E0D6EE086257746006C9EB3 

 

For reference, information about type def can be found here: http://zone.ni.com/reference/en-XX/help/371361F-01/lvconcepts/custom_cont_ind_type/

 

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

 

Stephen C
Applications Engineer
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page