LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display time remaining before event structure will timeout.

How do I get the time remaining before the event structure (LV 6.1) will timeout to be displayed on the front panel? I have thought of alternatives to create the same basic function but can't figure this exact solution out.
0 Kudos
Message 1 of 11
(4,937 Views)
gold,

Try this solution and see if it works for you.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 11
(4,936 Views)
The event structure here in nonfunctional, the timer loop doesn't allow its execution. Also I need the timer to reset(new 5sec) when any events in the event structure occur?
0 Kudos
Message 3 of 11
(4,936 Views)
gold,

Add an ouput from the event structure that when the event goes off, it stops the timing loop. This is the best idea I have come up with so far.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 4 of 11
(4,936 Views)
When the loop is running to display time remaining, the event structure is nonresponsive. Is there a way around this or can I never use a loop and event structure in paralell execution?
The big picture here is that I want to be able to have a vi running and if there is no mouse or keyboard input for >2min then I want the vi to close. I also want to be able to see the time remaining in an indicator, before the vi will close.
0 Kudos
Message 5 of 11
(4,936 Views)
I have attached a VI that illustrates the basics of how to do this. I have also included, "at no extra charge" a copy of my timeout VI. This is simply a VI that waits for the tick count to reach the value of the intial tick count plus the timeout value (in milliseconds.) If you need to know how it works, I can give you a screenshot of it so you can reproduce it.

This VI does what you last described, except that the counter is displayed in MS, not in minutes (you'll have to do th conversion yourself.) Also, the VI quits LabVIEW after the timeout. You will want to modify this so that it uses VI Server to close the front panel.


In essence, you do place a parallel loop to countdown the time remaining before the event times out. You wi
ll have to connect the start of the timer (initial tick count) to the start of the event in some way. I encapsulated a copy of the tick count with the error handler, so that I could do just this, and I would suggest that you do the same, this helps in tying things together like this. In order to reset the counter, I simply wrote a new value to a variable I called "Timer" from the tick count each time an event occurred. In the timeout loop, I initially wrote the tick count to "Timer", and in the loop, I read the value of "Timer" and compare it to the current tick count to determine the delta T before timeout. When timeout occurs, the loop ends at the same time the event times out (just about).

By the way, thanks for the challenge. I have never used event structures before. It took me all of five minutes to code this up, another tribute to how great LabVIEW is (although I'll still grumble, moan, and complain about not being able to create compact executables until that's fixed.
..)
Download All
Message 6 of 11
(4,937 Views)
Thanks thats what I've been trying to get at! Your implementation seems to be the same as I was trying to do but could never get there. Thanks!
0 Kudos
Message 7 of 11
(4,936 Views)
Hello Labviewgur, you helped a guy about problems by sending 2 vi´s // ATE_timeout.VI and Timeout_Quit_or_Reset_on_event.vi
Perhaps its the solution for my Problem, stopping a Countdown which has´nt finished from another vi.

I tried some others but the Problem won´s disappear.
Can you send the 2 examples to me again, but I only can use LV 6.02

Best regards

Andy
0 Kudos
Message 8 of 11
(4,858 Views)
Hello Andy,

I saved the examples that Labviewguru posted in LV 6.1 for you. I’m not sure what version of LabVIEW you are running. If you are running anything before LV 6.1 these examples will not work because they use the event structure which came out in LV 6.1. I hope this helps!

Best Regards,
Chris J
0 Kudos
Message 9 of 11
(4,834 Views)
Hello ChrisJ

thanks for the answer, but my Labview Version has a problem with that.
using 6.02
But maybe you can send me the Code as a snagit picture.

I use that vi started from another loop around
which should be stopped while executing by a button in the loop

-outside loop is starting this vi inside
-after short time user pressing exit button s
-theCountDown has to be stopped immediately to execute
another action

hope you´ll understand

Andy
0 Kudos
Message 10 of 11
(4,817 Views)