[time-nuts] Obtaining 32768Hz from 10 MHz
David Forbes
dforbes at dakotacom.net
Wed Dec 20 12:22:59 EST 2006
A discussion of driving computer clocks from accurate sources recently
came up. While it's true that PCs generally use the CPU clock or the
baud rate clock for the timekeeping function, the observation was made
that it might be nice to run a standard RTC that uses a 32768 Hz crystal
from a 10 MHz source. The TAPR Clock Block is not designed to do this,
but it is easy to do using a non-PLL approach.
Tom Van Baak has programmed a PIC microcontroller to make all decades of
frequencies from a 10 MHz source. In a similar way, the PIC can be
programmed to produce any frequency desired, such as 32768 Hz, using the
method of a dual-modulus prescaler.
If you're not familiar with this technique, read the Wikipedia entry:
http://en.wikipedia.org/wiki/Dual-modulus_prescaler
Since a PIC executes 2.500 MIPS when clocked at 10 MHz, its effective
input frequency is 2.5000 MHz. The output frequency is 32768 Hz. Thus
the modulus M is 76, and the remainder A is 9632.
This means that you would execute 9632 loops that take 77 clock cycles,
followed by (32768-9632) = 23136 loops that take 76 clock cycles, to
make exactly 32768 output cycles per second given a 10 MHz CPU clock.
The code for this should fill considerably less than a page of text.
Bear in mind that you would be making a very ugly 32768 Hz signal if
viewed in the frequency domain, so only use the above method for
timekeeping.
More information about the time-nuts
mailing list