By Muris Trax / elektronika.ba
Price: $not for sale
Muris Trax contacted me the other day and wanted to share his single digit in-8 clock. I've been meaning to add a user-added content section so here it is! (Images and video used with permission.)
Timekeeping and measuring
Inside of this box there is a 3V Lithium battery (CR2032) that keeps the PIC microcontroller running even when the clock is turned off (the wall adapter). This is very convenient because after powering it up again, we don't need to set the time - again. If a button is pressed during a power-down, nothing will happen. With PIC microcontroller I used a "watch" crystal at 32,768kHz. It's value is pretty cool and now we will see why. PIC16F84 has internal TMR0 counter that increments itself no matter what the PIC is doing at the moment. Think of it as a threaded sub-program. This counter can generate an interrupt when it's value overflows from 255->0. We can also prescale this counter to slow it down a bit so we can make it generate an interrupt on every 2, 4, 8, 16, 32, 64, 128 or 256 overflows. So, when we finally connect our 32,768kHz crystal on PIC microcontroller, we should also know that the speed it runs at is divided by 4 and this characteristic is only found with PIC microcontrollers. This all means that our PIC runs at 8,192kHz which tells us that TMR0 will overflow 32 times per second. Now when we prescale it by 32 it means that it will overflow once per second and generate us an interrupt. This we can use as a very precise time measurement. Anyway, source code is available for download so you can poke around.
YouTube Video of it in action: