LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop event structure when using a global variable

Hello,

I'm using many VI. There are one main VI. Each VI performs various tasks. Some of these tasks require that the VI run continue (read VISA), while other tasks are performed only when I press a button (for example when I want to hide the front panel). In this case I 'm using an event structure to optimize the program (see pic).

The problem I have is that I want to stop all VI from the main VI. To achieve this I use Stop LV2 Global.vi. In the VI in which there aren't event structures works fine, but when the VI have an event structure I don't know stop it.

Can you help me, please?

Thank you.


Download All
0 Kudos
Message 1 of 14
(2,998 Views)
Hi vicens,

you need to set a timeout for the event structure (or generate an other event)!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(2,985 Views)
I think the best option is to create other event... but I cannot because this new event would need a control, and I haven't a control. I have the indicator of Stop LV2 Global.vi Smiley Sad

If I set a timeout...  doesn't resolve my problem: stop  the vi from other vi. (I think)


Thanks
0 Kudos
Message 3 of 14
(2,974 Views)
Hi!

When opening and running the subVi's from the main Vi, save the references of each of them into global variable(s), and when nedded to stop any of them, use the invoke node from the Programming -> Application Control palette with the Abort Vi method.

I think this might help you!


Peter Smith
0 Kudos
Message 4 of 14
(2,968 Views)
This is what he was suggesting.
0 Kudos
Message 5 of 14
(2,966 Views)
Oh!

Thank you, all!!!!

Great, and so simple.

0 Kudos
Message 6 of 14
(2,955 Views)
Hi vicens,

invoke method with "abort vi" is like pushing the red button in the vi menu - it has side effects like non-closing of references, interrupted device communication...

You better stop a vi by some other mechanism!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 14
(2,945 Views)

"I think the best option is to create other event... but I cannot because this new event would need a control"

Wrong... there are user events... try Labview examples

0 Kudos
Message 8 of 14
(2,914 Views)

Pnt wrote "Wrong... there are user events... ".

I agree.

Ton's Dynamic Event Registration Nugget has some examples that may help.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 14
(2,903 Views)
Thanks for answer,

I've tried to create an event case in the event structure that runs each event return for a global variable, but it never succeeded. In the end I think I will use the example of Matthew.

Only me a question arises: What is the difference between to use event with a timeout and while loop with wait?
0 Kudos
Message 10 of 14
(2,868 Views)