LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop a sub VI from main VI

Solved!
Go to solution


Sorry I could not understand from your images. But where are you updating the value of string control??

Labview user
0 Kudos
Message 21 of 41
(711 Views)

When I receive the message OF0 via tcp (it arrives!), the case structures write the string "Spegni" and the value should change, because the default is null.

0 Kudos
Message 22 of 41
(709 Views)

By looking at your SubVi I found that in your sub vi event structure you have Stop2 boolean. when it is pressed it stops your SubVI. there you are also reading new value. In this event structure new value will be the value of Boolean Stop 2. You have to add another event case with Value(signaling) of string control string or Value to stop your Sub vi.

Labview user
0 Kudos
Message 23 of 41
(706 Views)

I have this event... case 2.
I attach all my program... I think is better than screenshot!

Download All
0 Kudos
Message 24 of 41
(704 Views)
Solution
Accepted by topic author Skeggy88

Here I have tried to attach a solution. It could not be the best but can help you. What I think the problem was that once you have connected a while loop for your subvi it can not take updated values from main vi. What I did was used multiple loops for controling a subvi. Hope it solves your problem.

In the main vi there are three buttons to Open a subvi close the subvi and close main program.

Labview user
Download All
0 Kudos
Message 25 of 41
(701 Views)

It works!! Thanks to all for your help!!!!

0 Kudos
Message 26 of 41
(696 Views)

@Aojha wrote:

Here I have tried to attach a solution. It could not be the best but can help you. What I think the problem was that once you have connected a while loop for your subvi it can not take updated values from main vi. What I did was used multiple loops for controling a subvi. Hope it solves your problem.

In the main vi there are three buttons to Open a subvi close the subvi and close main program.


Passing in a control ref from the main VI to the subVI is more robust than writing to a global on the outside and reading it on the inside.
  Less potential for race conditions.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 27 of 41
(681 Views)

 

billko wrote:

Passing in a control ref from the main VI to the subVI is more robust than writing to a global on the outside and reading it on the inside.

  Less potential for race conditions.


could you give simple exaple. It will be really helpful.

 

Labview user
0 Kudos
Message 28 of 41
(650 Views)

Aojha wrote:

 

could you give simple exaple. It will be really helpful.


Here is a very quick demo of reading and writing a main VI's controls by passing references to a subVI.

 

From a reference, read/write the Value using a Property Node

Certified LabVIEW Developer

Download All
0 Kudos
Message 29 of 41
(642 Views)

@billko wrote:

@Aojha wrote:

Here I have tried to attach a solution. It could not be the best but can help you. What I think the problem was that once you have connected a while loop for your subvi it can not take updated values from main vi. What I did was used multiple loops for controling a subvi. Hope it solves your problem.

In the main vi there are three buttons to Open a subvi close the subvi and close main program.


Passing in a control ref from the main VI to the subVI is more robust than writing to a global on the outside and reading it on the inside.
  Less potential for race conditions.


How does a reference minimize the chance for race conditions? The answer is it doesn't. You can still have race conditions because a control reference will allow access to the same control from two places at the same time.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 30 of 41
(627 Views)