Nxp semiconductors – NXP Semiconductors LPC24XX UM10237 User Manual

Page 657

Advertising
background image

UM10237_4

© NXP B.V. 2009. All rights reserved.

User manual

Rev. 04 — 26 August 2009

657 of 792

NXP Semiconductors

UM10237

Chapter 26: LPC24XX Real-Time Clock (RTC) and battery RAM

6.7.2 Prescaler Integer Register (PREINT - 0xE002 4080)

This is the integer portion of the prescale value, calculated as:

PREINT = int (PCLK/32768) - 1. The value of PREINT must be greater than or equal to 1.

6.7.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).

6.7.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

Table 579. Reference Clock Divider registers

Name

Size

Description

Access

Address

PREINT

13

Prescale Value, integer portion

R/W

0xE002 4080

PREFRAC 15

Prescale Value, fractional portion

R/W

0xE002 4084

Table 580: Prescaler Integer register (PREINT - address 0xE002 4080) bit description

Bit

Symbol

Description

Reset
Value

12:0

Prescaler Integer

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 581: 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

Advertising