LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stopwatch

I am trying to implement pause functionality in a timer/stopwatch. I am using tickcount as a base for timing . I am stuck at getting the pause functionality being achieved as each time the elapsed time gets added up. I have attached the VI. Kindly help me out with the VI . Each time when i switch from pause and resume , i am not able to achieve it properly . 

0 Kudos
Message 1 of 5
(2,969 Views)

Here's my solution:

 

Edited to add:  You should initilize the inner shift register with a Zero.

0 Kudos
Message 2 of 5
(2,939 Views)

Thanks for the simple VI , it was great . But still i couldn't rectify what mistake i am making in my case structure .  I know i need to configure the shift registers properly but i am unable to .

0 Kudos
Message 3 of 5
(2,920 Views)

When using loops like this you normally should put in some delay to avoid loading down your CPU.

My CPU usage went from 25% to 1% by adding a 1 ms delay. You don't need to go any faster.

 

Also important to note that you must use unsigned numbers when performing math operations with the Tick Timer. The timer will roll over at some point and unsigned math will handle this. (You did this, but I wanted to make that point.)

 

The main problem with your vi is that you are not accumulating the pause times from previous pause events.

 

See the example "mod" attached. I added two shift registers to handle accumulating pause times while (mostly) maintaining your program structure.

 

There are other ways to get this functionality. Check out the example "mod 1".

 

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 4 of 5
(2,897 Views)

Thanks a ton. I got it now and the documentation was the key in understanding , and i will also make it a habit . 

0 Kudos
Message 5 of 5
(2,893 Views)