From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop elapsed time express vi

Solved!
Go to solution

Hello All. I am making a program that allows one to turn on a DC power supply for a set amount of time. When the "On" button in pressed, a case structure with an elapsed time express vi launches. Once the specified time has elapsed, it write the value "false" to the ON/OFF control and resets.

The program works perfectly on the first run, but the clock does not stop. For example, if I set the value of the timer to 5 seconds, it will turn itself off after five seconds. Perfect. If I wait two seconds and turn it on again, the timer starts with 2, not 0. The program is technically useable, but can anyone show me a better way?

> Thanks.

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

Wire a true constant to the Reset input

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(5,465 Views)

Hi Paolo,

 

You can wire the "Time has Elapsed" output back to the reset (through a feedback node).

 

No need to auto reset. You also don't need to wire the present time to the start time.

There are other ways of achieving your desired functionality, but this is the quickest fix for the way you have chosen to program it.

Ian
LabVIEW since 2012
0 Kudos
Message 3 of 6
(5,390 Views)

Hello Ian.

 

I have already tried to wire the Time has elapsed output to the reset terminal, and it operates the same way as the auto reset button. Again, the issue isn't that the clock does reset, but that it doesn't stop.

 

Say I put 3 seconds on the timer and press "ON." The timer counts to three and switches off as it is supposed to. The clock resets. If I wait a second and press start again, the timer starts at 1 second instead of zero. If I let the timer reach three and reset, then wait more than three seconds, it will start with 4 seconds (as shown in the attached screenshot) and immediately shut itself off, as the time has elapsed. It will reset once again.

 

Furthermore, I find that without the present time terminal wired to the start terminal, the VI doesn't work at all. "Time has elapsed" always evaluates as true.

Thanks, Austin.

0 Kudos
Message 4 of 6
(5,378 Views)

Hi Austin,

You do need to remove the feedback from the present time to start time. I had it like this, which seems to work fine.

 

Capture.PNG

It doesn't fix the situation where if you press ON/OFF to turn if off instead of waiting for the timeout, you need further logic for this. You might also want to put in an extra stop command to be sent after the loop just before the visa close, in case the motor is still running when you press the stop button.

Ian
LabVIEW since 2012
Message 5 of 6
(5,371 Views)
Solution
Accepted by topic author runner.austin97

Hey Ian. You were absolutely correct about the present time terminal. It works.

 

Not sure if I made my problem abundantly clear, but I figured it out anyway! When I added the reset button shown in the attached screenshot and set the "mechanical action" of the button to "switch until released" I got exactly the behavior I wanted, where I am able to use the timer multiple times in one session and it always starts at zero.

And thanks for the heads up about the extra off protocol. The machine is within reach so I've been taking that stuff for granted.

0 Kudos
Message 6 of 6
(5,356 Views)