Showing results for 
Search instead for 
Did you mean: 

How to control execution of a Flat Sequence to have Cancel button

Go to solution

I have a question from you guys.
Assume that I want to write a program to control a set of hardwares by sending commands via serial port
Actually it calls a "Cycle". Because a series of specific commands will send via serial port in a specific time only once. I call this a one time Cycle.
Between each sending command steps there is a certain delay (Wait in Timing palette) . The attached is part of my VI.

I was wondering How can I embed a Cancel Button which is capable of acting in any frame of Flat Sequence Structure?
As you can see there is not any while loops to have better control of program because I want to execute series commands only one time.
So where to put "Cancel" Button in frames ?
I want to show a confirmation message when the user clicked Cancel Button and if the response was "YES" LabvIEW stops executing Flat Sequence Structure and the specific Cancel procedure (which is not included in above VI) occures . Else (by clicking "NO") program keeps running ...


Note that attached is just a simple version of what I'm intending for 

For example in some Frames there wil be a while loop and so on ...

But there will be only on flat sequence at all


Excuse me for my poor english

0 Kudos
Message 1 of 5
Accepted by topic author mostafanfs
08-27-2015 04:09 PM

Hi mostafi,


general answer: Convert your flat sequence into states of a proper state machine!

Now you can check your "Cancel" button after each state gets processed...

Best regards,
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 5

This community document seems to have some good information on the subject.  Specifically the LabVIEW Proficiency ppt.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 3 of 5

make your flat sequence to a state machine...

Message 4 of 5

Thanks you guys
I do not know why did not I figured that out by myself
Really Thanks

0 Kudos
Message 5 of 5