LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exit a programme

Hi every one,

My question must have been asked thousand times but please can someone tell
me whether it is possible to programmatically have subroutines in LV. In
other words, something that would look like a quit button subroutine that
could be called to see whether this button was pressed so as to quit the
programme
I have a lot of step to accomplish in a flat sequence and I would like to
enable the user to quit in case he needs to do so.
Because this is always the same with LV, namely if the programme is in the
beginning of a process and the user pressed quit or stop
It's only at the end that this button will start its action and quit the
programme.

Thank you for your help

Gérard



--
Gérard Férini
Switzerland
http://home.tiscalinet.ch/
gferini/
remove -move to reply personally
0 Kudos
Message 1 of 9
(3,657 Views)
Hello Gerard,

easy solution: check this button in every step of the sequence by using local variables. When using device communication I insert the stop signal into my error cluster.
You can make this "more complicated": using global variables, use a subvi for the emergency button, check the button in a subvi with the help of a reference and so on...

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,657 Views)
You could use the abort button in the menu bar to quit at any time without having to program anything. Of course this is not a graceful shutdown.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 9
(3,657 Views)
Thanks GerdW for your reply.

Regards
gérard




--
Gérard Férini
Switzerland
http://home.tiscalinet.ch/gferini/Main_Photos.html
remove -move to reply personally
"GerdW" wrote in message
news:50650000000500000075D60100-1079395200000@exchange.ni.com...
Hello Gerard,

easy solution: check this button in every step of the sequence by
using local variables. When using device communication I insert the
stop signal into my error cluster.
You can make this "more complicated": using global variables, use a
subvi for the emergency button, check the button in a subvi with the
help of a reference and so on...

Best regards,
GerdW
0 Kudos
Message 4 of 9
(3,657 Views)
Hi Gérard,

I would suggest that you take a look at the State Machine structure (New� >> VI From Template >> Frameworks >> Design Patterns >> Standard State Machine).

This programming structure is extremely flexible and expandable. It basically performs a sequence, depending on the return values from each step. This means that you can go to a certain �shutdown� state if you receive an error, or if the customer chooses to stop, or you can simply stop the loop without a state.

Please play with the State Machine example and read the documentation on it for more info.

Have fun!


Best regards,
Philip C.
Applications Engineer
National Instruments
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
Message 5 of 9
(3,657 Views)
Thank you Philip for this valuable suggestion. I've tried this to see by
myself what this "State Machine" had in mind.
Interesting but still waiting to see if it's going to be convincing?

Thanks anyway

Gérard


--
Gérard Férini
Switzerland
http://home.tiscalinet.ch/gferini
remove -move to reply personally
"Philip C." wrote in message
news:50650000000500000092D70100-1079395200000@exchange.ni.com...
Hi Gérard,

I would suggest that you take a look at the State Machine structure
(New. >> VI From Template >> Frameworks >> Design Patterns >> Standard
State Machine).

This programming structure is extremely flexible and expandable. It
basically performs a sequence, depending on the return values from
each step. This means that you can go to a certai
n "shutdown" state if
you receive an error, or if the customer chooses to stop, or you can
simply stop the loop without a state.

Please play with the State Machine example and read the documentation
on it for more info.

Have fun!


Best regards,
Philip C.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 9
(3,657 Views)

Hi Gérard,

The State Machine is one of the most popular Application Design Patterns available. I would recommend you to read the online State Machine tutorial [broken link removed], for you to evaluate how useful it would be to implement it in your application.


Best regards,
Philip C.
Applications Engineer
National Instruments

- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 7 of 9
(3,657 Views)

Sorry - here's the correct link.

Philip C.

- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 8 of 9
(3,657 Views)

Dear Philip,



After some attempt trying to modify the State Machine examples LV Provides,
I design my own application just to have a better idea about this manner of
programming.

You are right, this is absolutely something NI should teach as the basic way
of conceiving LV applications.



Thank you for all



Gérard



----------------------------

EPFL

The Swiss Federal Institute of Technology

Gérard Férini

Departement ISIC-GE

1015 Lausanne

Phone +41216933126

gerard.ferini@epfl.ch

----------------------------

remove -move to reply personally
"Philip C." wrote in message
news:50650000000500000033D80100-1079395200000@exchange.ni.com...
Hi Gérard,

The State Machine is one of the most popular Application Design
Patterns available. I wo
uld recommend you to read the
href="http://zone.ni.com/devzone/conceptd.nsf/webmain/C74CEC177A289DBD86256C4E00600196?opendocument"...
, for you to evaluate how useful it would be
to implement it in your application.


Best regards,
Philip C.
Applications Engineer
National Instruments

0 Kudos
Message 9 of 9
(3,657 Views)