LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopwatch

Hello, I am trying to make a simple stopwatch with start, stop, and reset functions. The stopwatch I made however is not able to be reset as the clock is running. If it is running and the reset button is hit it displayes a random time. If the reset is hit when the stopwatch is off it works fine though. If anyone knows how to fix this it would be greatly appreciated.

0 Kudos
Message 1 of 10
(2,544 Views)

Why do you think you need all these shift regsiters?

Why do you divide by 1000, just to multiply by 1000 a nanosecond later?

Did you search the forum for stop watch.

Tick count is random, so you to reset to need to feed the current tick back into the shift register, not zero.

0 Kudos
Message 2 of 10
(2,529 Views)

Hi Matthew,

 


@MatthewS1112 wrote:

If it is running and the reset button is hit it displayes a random time. If the reset is hit when the stopwatch is off it works fine though. If anyone knows how to fix this it would be greatly appreciated.


Well, it would be much easier when your code would be cleaned up:

It also would help to provide more comments in the code, especially on the purpose of each of those 3 shift registers!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 10
(2,525 Views)

Here's what I might do.  Simplify! (Do you really need milliseconds???)

 

(Of course personally I would just convert to seconds (DBL) and use a single indicator using time display).

 

altenbach_0-1588102881480.png

 

 

0 Kudos
Message 4 of 10
(2,509 Views)

@altenbach wrote:

(Of course personally I would just convert to seconds (DBL) and use a single indicator using time display).

 


altenbach_0-1588103416080.png 

altenbach_1-1588103451390.png

 

 

Message 5 of 10
(2,496 Views)

Don't have 2019... what is the formatting you used for the time display?

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 6 of 10
(2,490 Views)

Hi Frozen,

 

relative time, HH:MM:SS with 3 digits for milliseconds…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 10
(2,487 Views)

@Frozen wrote:

Don't have 2019...


It would seem more important to know what you have. 😄

 

Here's a 2015 version....

Message 8 of 10
(2,481 Views)

Thanks!

Frozen_0-1588104986400.png

 

That is what I was looking for 🙂

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 9 of 10
(2,469 Views)

You could even get rid of the high precision seconds at the expense of an additional division, like so

 

snip.png

mcduff

0 Kudos
Message 10 of 10
(2,430 Views)