Circuit Analysis
Before you layout a circuit, it's generally a good idea to understand what is happening in your schematic. And before you lay out a schematic, it's generally a good idea to understand what is happening in your block diagram.
"This book is a bit technical. If you are a beginner, it's okay that you don't understand everything that follows -- your first project will still be successful. Try to pick up as much as you can, and ask questions in the forums!"
6. Real Time Clock
RTC block from the schematic.
Real Time Clocks (RTC) are designed to keep track of seconds, minutes, hours, days, months, and years using an accurate clock source and a small power source. Some even include interrupts that can bring a microcontroller out of sleep at a particular time to perform a task.
Like the other devices in our circuit, the clock source is 32.768 kHz. Why such a seemingly odd value across all devices? It makes sense when you think about 32.768 Hz in binary. 215 is equivalent to B1000000000000000.
B15 | B14 | B13 | B12 | B11 | B10 | B9 | B8 | B7 | B6 | B5 | B4 | B3 | B2 | B1 | B0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
The RTC circuit detects the transitions of the oscillator, and a series of flip-flops on the die go to work successively dividing the signal 15 times, until the final stage of the circuit keeps track of seconds.
Binary counter from http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/bincount.html
That makes sense, but why 215 instead of 214 or 216? That likely harkens back to the days of digital watches. 215 was good enough to keep time within a minute per month. Each additional gate costs money to fabricate on an ASIC, so the watch/clock industry settled on "good enough." It's possible to purchase crystals at 65.536 kHz (216) and 131.072 kHz (217), but you'd need additional divider stages to work properly.
One other note: Bob is in the process of replacing the expensive oscillators with less expensive crystals.
"On a side note -- last year I installed 131.072 kHz in a clock designed for 32.768 kHz for a marketing gag, and it did run 4x as fast. Unfortunately, it was too far back in the background of the camera shot -- which made it appear small and blurry, so nobody noticed. Life is cruel."