220
Philips Semiconductors
Preliminary User Manual
LPC2119/2129/2292/2294
ARM-based Microcontroller
Example of Prescaler Usage
In a simplistic case, the pclk frequency is 65.537 kHz. So:
PREINT = int (pclk / 32768) - 1 = 1 and PREFRAC = pclk - ((1) x 32768) = 1
With this prescaler setting, exactly 32,768 clocks per second will be provided to the RTC by counting 2 pclks 32,767 times, and
3 pclks once.
In a more realistic case, the pclk frequency is 10 MHz. Then,
PREINT = int (pclk / 32768) - 1 = 304 and PREFRAC = pclk - ((1) x 32768) = 5,760.
In this case, 5,760 of the prescaler output clocks will be 306 (305+1) pclks long, the rest will be 305 pclks long.
In a similar manner, any pclk rate greater than 65.536 kHz (as long as it is an even number of cycles per second) may be turned
into a 32 kHz reference clock for the RTC. The only caveat is that if PREFRAC does not contain a zero, then not all of the 32,768
per second clocks are of the same length. Some of the clocks are one pclk longer than others. While the longer pulses are
distributed as evenly as possible among the remaining pulses, this "jitter" could possibly be of concern in an application that
wishes to observe the contents of the Clock Tick Counter (CTC) directly.
Figure 44: RTC Prescaler block diagram
13-bit Integer Counter
(Down Counter)
13-bit Reload Integer Register
(PREINT)
VPB Bus
15-bit Fraction Register
(PREFRAC)
Combinatorial Logic
15-bit Fraction Counter
Clk
Underflow
Clk
13
13
15
15
15
pclk
(VPB Clock)
To Clock Tick
Counter
Reload
Extend
Reload