LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Timer that runs when VI is done

Hi all,

 

I am trying to create a timer that will run continuously through a pin on the NI 9401 card which is connected to the NI cDAQ 9174 chassis.  This timer VI is going to be a part of a group of VIs that will be used in TestStand to complete automated hardware tests.  I want to be able to simply initialize the timer to a given frequency and duty cycle and then start the task and have it output the timer continuously even though the VI is not running anymore.  This way the timer is still running when TestStand exits the VI and moves on to another and it should be able to be stopped later on in the TestStand Sequence by clearing the task or some other way.  How would I do this? I have attached a jpg of a simple VI that I thought should do what I need but the timer stops running once the VI is done running.  Also I don't believe putting a while loop around the "Is task done" vi is the way I need to go because then TestStand won't exit the VI when its called.

Thanks!

Josh

0 Kudos
Message 1 of 4
(2,933 Views)

Some of your basic concepts are off. Some vi has to be running for any part of the program to work.

 

See the attached diagram. This is what I think that you are saying. Each test is a separte vi and you want to go from test to test. Test Stand VI is the over arching Vi that runs everything. You want the timer to keep running for all the different tests. 

 

Timer needs a while loop to keep running and will not run without it. Labview runs in a linear fashion. As to your problem to stop Test Stand Vi, if the inner loop for the timer is still going Test Stand VI will not stop. So if the stop button is pressed in Test Stand VI, you need to send a signal to the inner loop for the timer.

 

Suggestions: look up global stops on the forums. There a lot of different options like local variables (this probably is not a good idea) ,notifiers, or property nodes. I found some really good example for notifiers here. I strongly suggest notifers.

 

Hope this helps. 

 

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

Thanks for the reply but I figured something out.  I just added the while loop to my Timer VI and then created that VI into an executable since that will run in the background and TestStand can continue.  I then just simply created another VI that uses the System Exec.vi that will kill the application when I need too.

 

Thanks

0 Kudos
Message 3 of 4
(2,880 Views)

Glad you got it figured out. I was going to say that you can create a continous task in MAX.

 

But don't kill the poor little VI like that again or I will have to report you to PETVI. Just add a stop button or a panel close event like this. All you have to do to close it is click the Windows red X.

 

Task.png

=====================
LabVIEW 2012


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