From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Control the sub VI execution time

I want to control the execution time of one sub VI.
The sub VI (with one while loop) will auto-stop its running (is it possible to auto-close sub VI front pannel as well after it stops),  if one of following conditions is satified:
  1. The "Stop" button in the sub VI is clicked.
  2. The Sub VI Window, which appears in the PC screen, is killed.
  3. The Sub VI runs more than 10 seconds.

I have created one Main and one sub VI (see attached). However, it cannot work. Can anyone help me to figure out the reason?

thanks a million...

Xiaogang

 

Message Edited by Xiaogang on 01-09-2006 09:21 AM

0 Kudos
Message 1 of 4
(2,829 Views)
You were on the right track is appears with your VI.  The reason that your sub vi "never executed" was that the event structure in the sub vi never had a timeout on it (so actually your sub vi was working as it should, waiting indefinatly for the panel close to happen).  I added a timeout value to the event structure along with a timeout case so that the logic could cycle through and the loop would execute. 

Also, I added a Waitms to the While loop in the subvi in order to make sure that the CPU has time to execute other functions and not have a run on. 

As far as closing the sub vi front panel, if you right click the sub vi icon in your main vi block diagram, one option is SubVi node setup.  A dialog box will pop up and select Close VI afterwards if originally closed.  This will close the front panel when the sub vi finishes executing.

I hope this helps, reply if you need more help.

Kenny
Kenny

Download All
Message 2 of 4
(2,812 Views)
First, you need to setup the subVI in the main program:
  • right-click on it and select "subVI node setup". Now also check "close afterwards...". 
  • Place a small wit inside the loop, or better use an event structure.

Second, you need to correct your subVI. You only have a panel close event. You also need event cases for the other condition, else the event structure never completes.

Attached is one possibiltiy (labVIEW 7.1). Before running the main VI, make sure that the front panel of the sibVI is closed.

Message Edited by altenbach on 01-09-2006 07:44 AM

Message 3 of 4
(2,811 Views)

Hi, Kenny and altenbach,

thank you for your kind help.

my problem is successfully solved.

 

0 Kudos
Message 4 of 4
(2,782 Views)