LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Countup/down timer

I am trying to design a countup/countdown timer which has a check box which can select between countup and countdown mode. In countup mode when we click the start button counter starts counting the time since the start button was presses and displays the time in format of H:M:S. In countdown mode user enters time in the formsat of H:M:S and hits start, the counter should start counting down and should stop as we reach zero.
I looked through many discussions but couldnt find anything which works on both countup and countdown in the same program.
 
Thanks in Advance
0 Kudos
Message 1 of 9
(5,204 Views)
Hi Jacktahoe,
what have you done so far? You can use a loop with an event structure. Use a parallel loop to run the counter. Use a case structure to switch between count up and down.
 
Mike
0 Kudos
Message 2 of 9
(5,189 Views)
Here's an example of a simple up/down timer, it just uses a predefined interval for timing, if you need a more accurate timer in the ms range you may need a different method.
 
 
_______________________________________
Systems Test Engineer
Certified LabVIEW Architect (CLA)
0 Kudos
Message 3 of 9
(5,180 Views)

  Hi Karissa,

Thanks for replying. The VI you provided works great and thanks for providing it. But I am also done with this part, the only thing which my counter doesn't have is that when the user wants to countdown it doesn't allow the user to input the value for the countdown timer.

 

Thanks

 

 

0 Kudos
Message 4 of 9
(5,155 Views)
Hi Jacktahoe,
what have you done so far? You can use a loop with an event structure. Use a parallel loop to run the counter. Use a case structure to switch between count up and down.
 
Mike
 
Hi Mike,
 
So far I have implemented a counter which can count both up and down and to do this I used case structure to switch between up and down. The only issue left unhandeled is that my counter doesnt let the user input the values in the countdown/up mode. If you can suggest me on how to do that. i tried using local variables to read the values from the window and rewiriting back, but everytime I do this it overwrites the new value (user input) with the old calculated values.
 
Thanks
0 Kudos
Message 5 of 9
(5,154 Views)
Jacktahoe,

Put the count value in a shift register. Have a case structure which is selected when the start down count button is pressed. Inside the true case put the control with the new starting value. The false case just passes the value through. You should not need any local variables.

Lynn
0 Kudos
Message 6 of 9
(5,146 Views)

Thanks Lynn. I tired how you told and It works great. Now I am stuck on a minor detail, I want to reset the counter everytime I press my start button, right now the counter is being reset when I hit stop button. Whats the right way to reset the counter?

 

Thanks

 

0 Kudos
Message 7 of 9
(5,142 Views)
Please post what you have done so far. Trying to guess exactly what you have done is not very productive.

Lynn
0 Kudos
Message 8 of 9
(5,135 Views)
Thanks Lynn, I think I got it working. You all were very helpful.
0 Kudos
Message 9 of 9
(5,131 Views)