From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Solved!
Go to solution

Hi
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
(3,846 Views)
Solution
Accepted by mostafanfs

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,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,840 Views)

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

https://decibel.ni.com/content/docs/DOC-21334


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(3,832 Views)

make your flat sequence to a state machine...

Message 4 of 5
(3,817 Views)

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

0 Kudos
Message 5 of 5
(3,779 Views)