LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stopping a subvi from the main vi with a global variable

surely, here they are!

Ricky
Italian Developer engineer
www.www.selt-sistemi.com
Download All
0 Kudos
Message 11 of 20
(1,274 Views)

Dear Ricky,

 

Thank you for your reply. I ran the main vi and stop it. After that it was not possible to start it again. I imagine that this has to do with your notification about the mechanical action of the stop vi. Could you please be more specific because unfortunately I didn’t find an appropriate mechanical action mode. By the way, I notice that you have wired the loop iteration indicator with the while loop. It’s the first time I see something like that. Could you please explain why you did it?

 

Thank you in advance

0 Kudos
Message 12 of 20
(1,243 Views)

Hi LW42,

 

You can find a lot of information about the mechanical actions of the buttons on the NI website, here an exemple of how you can search the information there: mechanical actions.

For my sample, if I don't misunderstand what you want to do, you need 2 buttons. The first, the stop button, which is usually inserts into the VI panels to controls the shut-down of the panel and each its subVIs, will be check from the subVI to understand if the user has chose to shut down the applican, the second, the Run, button its uset to launch the subVI and to control its execution.

 

Look at these:

Ricky
Italian Developer engineer
www.www.selt-sistemi.com
Download All
0 Kudos
Message 13 of 20
(1,237 Views)

Hello Ricky,

 

Could you be so kind to submit the vis in 8.6.1 LabVIEW version.

 

Thanks for the help

0 Kudos
Message 14 of 20
(1,228 Views)

Of course, here they are!

 

 

Ricky
Italian Developer engineer
www.www.selt-sistemi.com
Download All
0 Kudos
Message 15 of 20
(1,221 Views)

Thanks a lot for the vis.

 

Best regards

0 Kudos
Message 16 of 20
(1,201 Views)

Elaborating on the original question, I am wondering why your (g_Ricky) example doesn't work if you modify main:

  • Attach indicator 'stop2' to 'stop' line
  • make reference to stop2 and connect this to the block of the subvi

If I run main, the indicator stop2 doesn't work and the value of stop is not passed to the block.

 

Is this weird or logical?

0 Kudos
Message 17 of 20
(882 Views)

@SteCla wrote:

Is this weird or logical?


Logical.  The loop in your main cannot iterate until everything inside has completed.  This includes the subVI.  And since the subVI has a loop, it must complete.  This is huge because the stop control is not read again (after you click on it) until the main VI's loop iterates again.  But it can't because the loop in the subVI is waiting for a reaction to that stop button being read.  What you have is a deadlock.


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 18 of 20
(871 Views)
Great, thanks, sounds logical! A next elaboration: using the IV server idea introduced earlier: I am kind of strugling making it to work with an event structure in the subvi... At this moment I am using the property node with value signaling but this means a lot of extra code. Any idea on how to simlpy trigger an event structure in the subvi using IV server and a main vi?
0 Kudos
Message 19 of 20
(863 Views)

You could pass in the reference to the control and dynamically register for the value change event.

 

But I have to advise against this setup that this thread is making.  If you have "long" things happening inside of a loop, it limits anything else in the loop from happening.  It would likely be better to have this be in a seperate, parallel, loop.


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 20 of 20
(856 Views)