LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

making an elapsed time clock help

I thought this would be pretty straight forward, but I'm stumped. My program is a producer consumer that uses notifiers for start/ early test stop. I wanted to have timer that would start when the start button was pressed run/update continuously, and stop when the test finishes or the user ends it with the stop button. The problem I'm having is that the state machine in the consumer loop has VI's in it that are essentially while loops that do things like wait for stable measurements, collect data, etc. So once the program enters one of these loops the clock wont be updating. I have tried setting the elapsed time up in the producer loop, consumer loop, and just tried to make a third loop for just the timer. Could someone please help me out if what i'm trying to do is even possible?

 

I've attached a simple little VI that is sort of like my real program, i have been trying to set the timer up on this just to see if it can be done.

 

Thanks

0 Kudos
Message 1 of 6
(1,450 Views)

Get rid of the inside loops. Make them states in your state machine.You are likely also not able to stop the program when it is in one of those loops. 

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

I am able to stop when in those loops through the notifier and references. The loops gather data and such, just make it a state and run the same state a few hundred times? 

0 Kudos
Message 3 of 6
(1,433 Views)

Yes. You're already running the state a few hundred times, you're just doing it inside a second loop. You may find that it simplifies a lot of things.

0 Kudos
Message 4 of 6
(1,423 Views)

ugh i have like 50 states, it sounds miserable going through and changing all(most) of them lol. I see what your saying though.

0 Kudos
Message 5 of 6
(1,420 Views)

Your second loop should work, it just doesn't solve future problems that might arise. There's a couple of things that you should do, though. First, get rid of the Cancel Notification in both of your loops. This is creating a race condition and is not necessary. Next, change the Wait on Notification in the "1 min" state to have a timeout. You then do not need any other wait in the loop.

0 Kudos
Message 6 of 6
(1,367 Views)