11-14-2011 06:45 AM
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 .
11-14-2011 11:00 AM - edited 11-14-2011 11:02 AM
Here's my solution:
Edited to add: You should initilize the inner shift register with a Zero.
11-14-2011 10:45 PM
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 .
11-15-2011 06:02 AM
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
11-15-2011 06:29 AM
Thanks a ton. I got it now and the documentation was the key in understanding , and i will also make it a habit .