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.
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.
07-24-2012 05:07 AM
I can't make any solution for out from infinite loop, so I try to use abort execution .
Thanks to all.....
07-24-2012 06:08 AM
You shouldn't implement infinite loops. Read about state machine.
Norbert
07-24-2012 07:28 AM
@wMw wrote:
I can't make any solution for out from infinite loop, so I try to use abort execution .
Thanks to all.....
Then your problem isn't that there is no simple way to place those buttons. Your problem is that you are creating infinite loops.
Rule #1 of programming: Don't create infinite loops.
Rule #1a of programming: Unless you're programming a microprocessor, which is designed to be used in situation where you can simply turn everything off.
05-05-2017 09:10 AM
In some rare cases you may want o hit the abort button and re-start. Lets say some instruments fail intermittently and you want to avoid showing the abort and run button and have the user give a another try starting from scratch.
This is not the recommended method but it may do what you are looking for and it is very simple to do in an event handler.
CHECK THIS NI LINK:
http://digital.ni.com/public.nsf/allkb/19973E97DD7AFED386256E1D0075404F
Hope this helps
05-05-2017 09:26 AM
@Norbert_B wrote:
You shouldn't use "abort execution". Never ever!
What you are looking for is a state machine with idle case. In this idle case, you poll the "run" button. Once your machine is working, all your transitions will poll the "abort" button (i would rather call it "stop" in distinction to "quit") and handle it appropriately.
Norbert
EDIT: Danil is of course right. The buttons i refer to are front panel elements (not connected to the "buttons" in the icon bar!) and so the VI has to run in order to poll those buttons.
I disagree. I use the Abort button frequently when things go haywire in development; and I have a link on my desktop to Abort_All_VIs.vi (which autoruns).
Also, I don't like polling. Event driven programming is much better.
05-05-2017 09:35 AM
@Norbert_B wrote:
@smercurio_fc wrote:
@Norbert_B wrote:
You shouldn't use "abort execution". Never ever!
Unless you have a situation like this. (note that it's from the same poster)[...]
Still i insist on NEVER EVER!
It always gives me stomacheache seeing something like this. To be more precise: You should never ever come into a situation like this!
There is a reason for advanced design patterns like producer/consumer or actor framework......
Norbert
You can insist all you want, but I don't think people should care about your zealotry. I use infinite loops and the Abort button frequently when trying out little pieces of code. Sometimes I even use the "Run Continuously" button (did you know you can turn that on programmatically?). Of course I don't put stuff like that in deployed S/W.
"All buttons are meant to be pushed"
05-05-2017 09:41 AM
Paul,
its a 5 year old thread and a new reference to an implementation in LabVIEW 7.0 (no event structure in all versions)
Probably worth ignoring since the OP has very likely learned not to create infinite loops by now (or doesn't use LabVIEW anymore --same effect, no infinite loops)
Watch that Abort_All_VIs.vi and its nasty counterpart "Revoke All Models.vi" they can change VI execution properties without notifying the developer.
05-05-2017 10:37 AM
05-05-2017 11:00 AM
@paul_cardinale wrote:
If I recall correctly, event structures showed up in LV 6.1
Required Pro. Not in Base or Student. I don't recall if Full had it
05-05-2017 01:58 PM
I think "full" and "student" had the event structure since it was introduced. Only "base" didn't have it.