01-19-2021 11:27 AM
Hi, I would like to simply abort subvis that I called by reference, I spent hours on the forum without finding anything. It seems simple thing but I can't do it XD
Please find attached the call by reference that I want to stop from the main vi.
Thanks!
Victor
Solved! Go to Solution.
01-19-2021 04:44 PM
I don't think I've done this for almost a decade! [I've used Start Asynchronous Calls all the time ...].
What you need to do is to get a "Stop" snuck into the sub-VI. One way to do this is to create a Global Variable (call it "Global Stop"). Place it in your Asynchronous VI in such a way that when its value returns "True", your Sub-VI stops (I assume you are running something like a While Loop). So all you need to do is to initialize the Global to False, start your code, and when you want to stop the Sub-VI, wire a True to the Global Stop.
Bob Schor
01-20-2021 01:21 AM - edited 01-20-2021 01:25 AM
Hi Bob, thanks a lot for you answer!
I already tried to put a "Stop" in the sub-vi and pass a boolean to it as argument from the main vi. That's actually worked but it stops also the main vi, not only the subvi 😕 I know the "Stop" bloc is not really done for this kind of use so I guess it's a normal behavior, but I really can't figure out how to do this.
Victor
01-20-2021 01:32 AM
Why do you want to abort it? It's just as easy to stop it in a graceful manner.
01-20-2021 03:07 AM - edited 01-20-2021 03:24 AM
Hi!
To be "clean", the main vi should be able to abort the sub vi if this last crashs for example. Sometimes the sub vi is calling an executable which can crash and after a timeout, the main vi should be able to close everything.
01-20-2021 05:23 AM
Add a User event input to the sub vi's. Then you can easily send them any type of command as they're running, including one to shut down.
01-20-2021 06:26 AM
@ViGii wrote:
Hi, I would like to simply abort subvis that I called by reference, I spent hours on the forum without finding anything. It seems simple thing but I can't do it XD
Please find attached the call by reference that I want to stop from the main vi.
Thanks!
Victor
If you open the VI Ref with option 100 hex, and instead of Call By Reference, use Start Asynchronous Call and Wait On Asynchronous Call then you can just the the Abort method.
01-20-2021 06:56 AM
Ahah I exactly did that this morning ! It's working but still an issue... It's not working after builing an executable, I'm currently investigating why 😅
Thank you a lot for you help Paul, I should have asked for help before 🙂
01-20-2021 02:53 PM
When I am putting together a test sequencer or a simple fault finding front end I normally have something like a functional global called "Stop" which I can set to "True" when the operator hits the "Stop" or "Abort" button on the main front panel.
In all the sub VIs I call that take longer that a few seconds to run I add the "Stop" global in various places, such as the terminator of loops etc. Sometimes an abort is too brutal, for instance you may want to ensure power supplies are reset or the unit is put back into a safe mode.
Once you get back to an idle state then you can clear the "Stop" flag.
Especially when fault finding problematic boards, there are lots of times when you want to abort a long measurement or sequence of measurements.
01-25-2021 11:28 AM - edited 01-25-2021 11:29 AM
I managed to get the executable working with the Paul's solution but only if I'm going to Property and check the Use Labview 8.x file structure... Do not know why but that's another subject.