From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping Subvi and returning a value from SubVI to MainVi

Solved!
Go to solution

Hi All ,

 

I have a MainVI which calls a SubVI . The call to the SubVI from the MainVI is done inside a while loop . If the computation time taken in Subvi exceeds say 1 second I want to stop the subvi and in parallel I want to feed a default value to the MainVI that is suppose to be given by the SubVI . With the next iteration i have to call the SubVI again to do my task . Please let me know how this can be done Thanks in Advance .

 

Regards,

Magi

 

0 Kudos
Message 1 of 6
(2,505 Views)

Put an elapsed time express VI in the loop of the subVI so that its loop stops if it takes longer than a second.

 

0 Kudos
Message 2 of 6
(2,496 Views)

Thanks for your valuable input . In the process of stopping the SubVI i will not be able to deliver the required value to the mainVI.Can you please let me know how can i let the mainVI know the SubVI has been terminated due to the Time out condition and how should i take the default value instead of taking the value from SubVI(which on conditional termination will not deliver a value at all ) and vice versa if the SubVI works perfectly fine .Thanks in Advance .

Regards,

Magi

0 Kudos
Message 3 of 6
(2,477 Views)
Solution
Accepted by topic author magi20

Magi,

 

The subVI terminals will always have some value when the subVI returns.  If you do not set any other value, the value will be the default. Add a boolean output from the subVI to indicate whether it timed out or terminated normally.  Test that boolean in the main VI to see whether the data value is valid or not.

 

The questions you are asking are very fundamental to the way LabVIEW works. I suggest that you sepnd some time with the on-line tutorials on Getting Started With LabVIEW. What you learn there will more than make up for the time you spend asking basic questions.

 

Lynn

0 Kudos
Message 4 of 6
(2,470 Views)

Lynn ,

 

Thanks a lot for the input . I would take ur advice and will work on the same .

 

Regards,

Magi

0 Kudos
Message 5 of 6
(2,466 Views)

Then please mark the most helpful post as solution, and not your own. You can unmark the current solution from the options menu.

0 Kudos
Message 6 of 6
(2,463 Views)