In order to have the counter work as a clock, it needs to count once every second - except:
- At 59 seconds it needs to advance not one count, but 41 counts to get to the next minute
- At 59 minutes and 59 seconds it needs to advance 4041 counts to get to the next hour
- When the clock needs to either for to 00:00:00 (24 hour) or 1:00:00 (12 hour) the counter needs to reset to 00:00:00
- If it is 12 hour mode, at 1:00 it needs to reset and then count to 10000 times
The software to do this is simple:
- Keep track of where the counter is
- Get the time
- Convert the time to an integer (2:45:02 => 24502)
- Find the difference of the current count and the current integer
- If the difference is positive, advance the counter that far
- If the difference is negative, reset the counter and then advance to where it needs to go
Advancing the counter may take more than a second, so it may need to advance again after getting to the current integer. But that make the display look cool! :)
The counter I have, General Radio 1192-B from 1972 (based on date codes on chips inside) has a beautiful Nixie-tube display, and the one I found has 2 of the optional extra digits, so has the perfect 6 needed for a clock.
One requirement for the clock is the reset. I guess all frequency counters have a reset button on the front. I have another counter, a Global Specialties "5001 Universal Counter Timer", but it lacks a remote count reset. Luckily the General Radio counter has Start and Stop inputs on the back. Only the Start input is needed to reset the count.
The Start input requires a 5v level to reset, so I used a simple level shifter using a 2n3904 transistor and 2 10k resistors.
Ha I love this! I'm definitely going to keep a lookout for a cheap frequency counter, but I'm tempted to do it with a microcontroller and 7 segment displays anyways just to get the "fast forward" effect!