LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New, trying for a simple timer

I'm new to Labview and I'm trying to make what should be a simple timer.

Specifications:
(1) A "Start" button starts the timer.
(2) A "Stop" button stops the timer.
(3) A knob controls the timer duration.
(4) Something (right now it's just a sine wave generator) runs while the timer is running.
(5) A status LED lights while the timer is running.
(6) The LED and the "something" in #4 turn off when the timer isn't running.
(7) The timer does not run when the VI starts up.
(8) The timer may be turned on or off multiple times while the VI runs.


I can't get #2 and #7 to work.  The Elapsed Time VI keeps running, so putting my Stop button together with the Time Has Elapsed wire on an "Or" operator doesn't work.  Further, upping the knob value (say, from 2 s to 7 s) after the timer runs out will turn everything back on (because the new, later time hasn't arrived yet).  As for #7, I'm not really sure what to do about that.

Here's a picture of my latest.  Edit: The True condition is nothing more than a False constant wired to the "Busy" LED.

Message Edited by DJDDA on 09-29-2007 11:24 AM

Message Edited by DJDDA on 09-29-2007 11:25 AM

0 Kudos
Message 1 of 14
(3,920 Views)
It would be much easier if you would attach your VI instead of a picture so we can test it live. (also, most express VIs have configurations that are not visible from the picture alone).


@DJDDA wrote:
...I can't get #2 and #7 to work.  ...As for #7, I'm not really sure what to do about that...
I don't quite understand some of your descriptions, for example, you say that you solved #7, but later you say you don't know what do do about it. What determines the loop time of the big loop?
0 Kudos
Message 2 of 14
(3,901 Views)
VI attached.

I don't really understand, your post, though.  Where do I say that I solved #7?  Even in your quote, I say that "I can't get... #7 to work... I'm not really sure what to do about that."  As for the "big loop," do you mean the While loop?  It's just there to keep the VI from turning itself off.
0 Kudos
Message 3 of 14
(3,899 Views)

Sorry, I misunderstood.

Here's one possible solution. Yes, the big loop currently runs at near infinite speed, consuming all CPU. Typically, you want to place a small wait (e.g.50ms) to make the loop time reproducible between machines and limit CPU use.

You are also generating 100 points, but you are only displaying one. Seems like a waste. 😉

Why are you using tiny font on the front panel and arbitrary color distinction (everything is red!). Also, the classic controls are a bit ugly and outdated. 😉

You should also remember that LabVIEW 8.5 is very new and most here don't have it. If you would convert your VI to 8.0 before attaching, many more can inspect it. 🙂

0 Kudos
Message 4 of 14
(3,889 Views)
Wow, I would never have gotten close to that... I definitely need to learn more.

That's okay, but it has a new problem:  If I hit the (ugly red) Stop button, it (very briefly) takes data points again.  I don't want the Stop button causing more data to be taken.  How do I fix that?
0 Kudos
Message 5 of 14
(3,846 Views)
Sorry, I am on a public computer and don't have access to LabVIEW. Typically, you would just create a seperate event case for the stop button. See how far you get.
0 Kudos
Message 6 of 14
(3,820 Views)
I do not see the purpose of the ugly stop button.  Just use the other one.  It will not stop your code anyway.  the case for stopping your VI is triggered off of the 'not ugly' stop boolean

Paul
0 Kudos
Message 7 of 14
(3,808 Views)
My attempts to do something different wound up with me trying to reproduce altenbach's timer mod from scratch (well, kinda).  I think I get most of it now, but there's one little thing I can't seem to fix:

When I hit Stop, it stops.  When TDone changes, the same should happen, because my event case ought to fire when Stop or TDone changes.  But when TDone changes--which, as it lights up, I know it does--the blasted thing keeps running!

Ideas?
0 Kudos
Message 8 of 14
(3,776 Views)
Because you've only got stop wired to the stop terminal of the while loop.  In your event for stop and tdone, use a constant True wired to the stop terminal of the loop.
0 Kudos
Message 9 of 14
(3,773 Views)
Er, sorry, I seem to be having communication issues.  Never mind the Stop button.  What I want to know is, "Why doesn't the meter stop moving when the TDone light comes on?"

Slight modification, posted for clarity:
0 Kudos
Message 10 of 14
(3,746 Views)