07-04-2017 08:36 AM
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.
Solved! Go to Solution.
07-04-2017 08:43 AM
Wire a true constant to the Reset input
07-05-2017 02:47 AM
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.
07-05-2017 04:06 AM
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.
07-05-2017 04:20 AM
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.
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.
07-05-2017 08:15 AM
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.