LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine run time elasped time

I know i'm making this more complicated than it should be.  I just want a count down timer for a simple state machine based on the delay for each case within the state machine. I just want to give the user a time remaining clock so they know how long the VI has left to run.   I want the timer to start when the state moves to the second case.  I have tried to do this several different ways and each time the time does not run continues.  I thought using parallel loops would allow the timer loop to continue running without being influenced by the main state machine loop. I tried using notifiers to stop both loops and to trigger the start of the timer.  It works, however the timer does not count down continues.  It jumps down as the state machine moves between cases.  To try to better understand how to fix this, I removed the notifier to trigger the start of the timer and placed the send notifier for the stop in the timer loop.  This allows the timer to countdown correctly but I can't trigger the timer to start when I want to.  I know this is wiring the notifiers backwards but I helped me understand the polling of the notifier, Iat least I thought so.  I thought the probem might be the local variables for adding the times together but I removed them and that didn't help.    Is a notifier the wrong way to do this or am I just using them incorrectly?

 

Thanks for the help.

 

 

 

 

Danny
Download All
0 Kudos
Message 1 of 4
(3,335 Views)

Have you tried a Functional Global Variable style design to control access to the timer? You could build actions that would Start, Stop, Reset and Read the Timer? If you made it not reentrant then only one action would happen at a time.

 

In this way the Timer could run independently and should give you no problems.

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

I am sure there are more of these elsewhere and probably with more detail but this is a FG one I have used in the past.

It automatically starts as this is an example of how to use the FG,  but you can simply not read until the start button has been pressed if you want to use the whole thing.
Hope it helps.

Peter

0 Kudos
Message 3 of 4
(3,085 Views)

How about something simpler, like this (wired at the moment for 3 timers), easily adaptable to different situations.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 4 of 4
(3,066 Views)