LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Oh no! Not another stop watch question?!?!?!

Hi

 

This question corresponds to the thread

 

http://forums.ni.com/t5/LabVIEW/Stopwatch-without-pausing-the-program/m-p/828959

 

The stopwatch.vi cannot be used as a subVI.

 

How do I get over this issue?

 

I essentially want to keep the start/stop boolean control as/is as well as the reset boolean along with the "STOP WATCH" numeric indicator.

 

Any feedback is greatly appreciated oh Knights of LabVIEW!

 

A student intern cries out desperately for help!

 

 

0 Kudos
Message 1 of 10
(3,524 Views)

If you try to call this vi as a subvi, your main vi will pause until the subvi finishes.  I'm sure this is not what you want.  You can copy the code in the stopwatch vi and put it into your main, in parallel to your other code.  Then you can use the stopwatch while your main vi is running.  Or you could call the stopwatch vi dynamically by opening a reference to the vi and using the RunVI method.

 

Example_VI_BD.png

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 10
(3,512 Views)

I will definately take this into consideration, however I want to use this VI a total of 12 times.....Smiley Indifferent

 

Which was the main motivation behind asking this question.

 

Could I still call the stopwatch vi dynamically by opening a reference to the vi and using the RunVI method (12 times?), if the main VI was to be an executable installed in a computer that does not have LabVIEW installed in it?

 

Or perhaps an example of a subVI which I could directly use be more appropriate?

 

Thanks

0 Kudos
Message 3 of 10
(3,494 Views)

If you set the VI to Reentrant Execution, you can then call it many times from many VIs.  Go to File - VI Properties and select the Execution category.  There you will see a checkbox for Reentrant execution.  Check it.  Save the vi.  It should work even from an exe.

 

By making it reentrant, Labview will create a new data space every time it is called.  This way there is no interference between one instance and the others.

- tbob

Inventor of the WORM Global
Message 4 of 10
(3,488 Views)

Hi tbob thanks again for the output.

 

How do I use the invoke property node in place of the subVI in the attached VI.

 

Is it even possible to use this with an array?

 

Can I make this array of time.vi a subVI to be used in my main VI?

 

Thank you so much for your time!

 

 

 

 

0 Kudos
Message 5 of 10
(3,479 Views)

You are calling several subvi's and expecting an output from them to append to an array.  Running the subvi's dynamically doesn't make sense here.  Tell me just what are you expecting to do.  Running a subvi dynamically is usually used to run some code in the background where no return value is expected.  Calling the stopwatch vi several times means the front panels will all pop up and the user has to manipulate the controls on each subvi.  What is the purpose?  You didn't attach the subvi so what are the inputs and outputs?

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 10
(3,444 Views)

Hi tbob thank you again for your reply

 

Please refer to the attatched VI.

 

I am trying to build a VI that will monitor the "ageing" of "lamps" in hours. There are two banks A and B, each having 6 Modules, each having 8 lamps each, for a total of 2 * 6 * 8 = 96 lamps.

 

I essentially want to monitor the ageing of every single lamp. Which is why I believe using arrays would be an efficient way.

 

Each module will go through a period of ON/OFF power cycles. All the while accumalating the total hours that the lamp was ON. During this time a lamp can fault (much like a fused bulb) and hence the timer will stop.

 

The total time that the lamp in ON will be recorded and saved on an external file in the hardisk, so even if the LabVIEW program crashes, the data will not be lost. I should also be able to manipulate the external file in case I want to add/remove hours from that lamp.

 

I hope this clarifies my purpose.

0 Kudos
Message 7 of 10
(3,428 Views)

Your stopwatch vi requires operator input.  You should have a vi that does not require operator input so that it can run and then return its value when done.  Then all you have to do is set this vi to reentrant and you can call it many times.  There is no need to even call it dynamically.  They will run at the same time in different memory spaces at the same time.  The rest of your code will wait until it has an output from each instance of the stopwatch vi.  If you want the rest of the code to run while the stopwatches are running, then you have to call it dynamically and set the Wait Until Done to false.  You can pass the outputs of the stopwatch vi's to the main by using references.

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 10
(3,413 Views)

Hey tbob

 

could you perhaps post an example VI?

 

Thanks as always.

 

 

0 Kudos
Message 9 of 10
(3,400 Views)

I'm so sorry I don't have time to create examples.  My regular job is quite demanding at this time.  Modify your stopwatch vi to not have user buttons.  Set it to reentrant by clicking on File - VI Properties, select the execution category and check the reentrant checkbox.  Now you can place this subvi as many times as you wish.

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 10
(3,391 Views)