15.11.2012 Views

LPC2131/2132/2138 User Manual - mct.net

LPC2131/2132/2138 User Manual - mct.net

LPC2131/2132/2138 User Manual - mct.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Philips Semiconductors Preliminary <strong>User</strong> <strong>Manual</strong><br />

ARM-based Microcontroller<br />

Example of Prescaler Usage<br />

In a simplistic case, the pclk frequency is 65.537 kHz. So:<br />

PREINT = int (pclk / 32768) - 1 = 1 and PREFRAC = pclk - ((PREINT +1) x 32768) = 1<br />

<strong>LPC2131</strong>/<strong>2132</strong>/<strong>2138</strong><br />

With this prescaler setting, exactly 32,768 clocks per second will be provided to the RTC by counting 2 pclks 32,767 times, and<br />

3 pclks once.<br />

In a more realistic case, the pclk frequency is 10 MHz. Then,<br />

PREINT = int (pclk / 32768) - 1 = 304 and PREFRAC = pclk - ((PREINT +1) x 32768) = 5,760.<br />

In this case, 5,760 of the prescaler output clocks will be 306 (305+1) pclks long, the rest will be 305 pclks long.<br />

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<br />

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<br />

per second clocks are of the same length. Some of the clocks are one pclk longer than others. While the longer pulses are<br />

distributed as evenly as possible among the remaining pulses, this "jitter" could possibly be of concern in an application that<br />

wishes to observe the contents of the Clock Tick Counter (CTC) directly.<br />

Clk<br />

13-bit Integer Counter<br />

(Down Counter)<br />

13<br />

Reload<br />

Underflow<br />

13-bit Reload Integer Register<br />

(PREINT)<br />

Extend<br />

Reload<br />

To Clock Tick<br />

Counter<br />

15-bit Fraction Counter<br />

Combinatorial Logic<br />

15-bit Fraction Register<br />

(PREFRAC)<br />

13 VPB Bus<br />

15<br />

Figure 52: RTC Prescaler block diagram<br />

Real Time Clock 217 November 22, 2004<br />

15<br />

15<br />

Clk<br />

pclk<br />

(VPB Clock)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!