 MatthewS1112
		
			MatthewS1112
		
		
		
		
		
		
		
		
	
			04-28-2020 01:48 PM
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.
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			04-28-2020 02:08 PM
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.
 GerdW
		
			GerdW
		
		
		 
		
		
		
		
		
	
			04-28-2020 02:10 PM - edited 04-28-2020 02:10 PM
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!
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			04-28-2020 02:40 PM - edited 04-28-2020 02:46 PM
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
		
			altenbach
		
		
		 
		
		
		
		
		
	
			04-28-2020 02:51 PM
@altenbach wrote:
(Of course personally I would just convert to seconds (DBL) and use a single indicator using time display).
 
 Frozen
		
			Frozen
		
		
		
		
		
		
		
		
	
			04-28-2020 02:57 PM
Don't have 2019... what is the formatting you used for the time display?
 GerdW
		
			GerdW
		
		
		 
		
		
		
		
		
	
			04-28-2020 03:02 PM - edited 04-28-2020 03:03 PM
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			04-28-2020 03:08 PM
@Frozen wrote:
Don't have 2019...
It would seem more important to know what you have. 😄
Here's a 2015 version....
 Frozen
		
			Frozen
		
		
		
		
		
		
		
		
	
			04-28-2020 03:17 PM
Thanks!
That is what I was looking for 🙂
 mcduff
		
			mcduff
		
		
		
		
		
		
		
		
	
			04-28-2020 09:06 PM
You could even get rid of the high precision seconds at the expense of an additional division, like so
mcduff