UM10237_2 © NXP B.V. 2008. All rights reserved.
User manual Rev. 02 — 19 December 2008 658 o f 792
NXP Semiconductors UM10237
Chapter 26: LPC24XX Real-Time Clock (RTC) and battery RAM
PREINT = int (PCLK/32768) - 1. The value of PREINT must be greater than or equal to 1.
10.3 Prescaler Fraction Register (PREFRAC - 0xE002 4084)
This is the fractional portion of the prescale value, and may be calculated as:
PREFRAC = PCLK - ((PREINT + 1) x 32768).
10.4 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 - ([PREINT + 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 - ([PREINT + 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(Section 26–6.2.2 “Clock Tick
Counter Register (CTCR - 0xE002 4004)” on page 651).
Table 581: Prescaler Integer register (PREINT - address 0xE002 4080) bit description
Bit Symbol Description Reset
Value
12:0 Prescaler In teger Contains the integer portion of the RTC prescaler value. 0
15:13 - Reserved, user software should not write ones to reserved
bits. The value read from a reserved bit is not defined. NA
Table 582: Prescaler Integer register (PREFRAC - address 0xE002 4084) bit description
Bit Symbol Description Reset
Value
14:0 Prescaler
Fraction Contains the integer portion of the RTC prescaler value. 0
15 - Reserved, user software should not write ones to reserved
bits. The value read from a reserved bit is not defined. NA