Real-Time Clock/System Timer; Real-Time Clock Source; Changing Rtcs1-0; Real-Time Clock/System Timer Block Diagram - Philips P89LPC920 User Manual

80c51 8-bit microcontroller with two-clock core
Table of Contents

Advertisement

Philips Semiconductors

REAL-TIME CLOCK/SYSTEM TIMER

8. REAL-TIME CLOCK/SYSTEM TIMER
The P89LPC920/921/922 has a simple Real-time Clock/System Timer that allows a user to continue running an accurate timer
while the rest of the device is powered down. The Real-time Clock can be an interrupt or a wake-up source (see Figure 8-1). The
Real-time Clock is a 23-bit down counter. The clock source for this counter can be either the CPU clock (CCLK) or the XTAL1-2
oscillator, provided that the XTAL1-2 oscillator is not being used as the CPU clock. If the XTAL1-2 oscillator is used as the CPU
clock, then the RTC will use CCLK as its clock source regardless of the state of the RTCS1:0 in the RTCCON register. There are
three SFRs used for the RTC:
• RTCCON - Real-time Clock control.
• RTCH - Real-time Clock counter reload high (bits 22-15).
• RTCL - Real-time Clock counter reload low (bits 14-7).
RTCH
Reload on underflow
MSB
W ake up from
Power-down
Interrupt
if enabled
(shared w. W DT)
The Real-time Clock/System Timer can be enabled by setting the RTCEN (RTCCON.0) bit. The Real-time Clock is a 23-bit down
counter (initialized to all 0's when RTCEN = 0) that is comprised of a 7-bit prescaler and a 16-bit loadable down counter. When
RTCEN is written with '1', the counter is first loaded with (RTCH,RTCL,'1111111') and will count down. When it reaches all 0's,
the counter will be reloaded again with (RTCH,RTCL,'1111111') and a flag - RTCF (RTCCON.7) - will be set.
Any write to RTCH and RTCL in-between the Real-time Clock reloading will not cause reloading of the counter. When the current
count terminates, the contents of RTCH and RTCL will be loaded into the counter and the new count will begin. An immediate
reload of the counter can be forced by clearing the RTCEN bit to '0' and then setting it back to '1' .

Real-time Clock source

RTCS1-0 (RTCCON.6-5) are used to select the clock source for the RTC if either the Internal RC oscillator or the internal WD
oscillator is used as the CPU clock. If the internal crystal oscillator or the external clock input on XTAL1 is used as the CPU clock,
then the RTC will use CCLK as its clock source.

Changing RTCS1-0

RTCS1-0 cannot be changed if the RTC is currently enabled (RTCCON.0 =1). Setting RTCEN and updating RTCS1-0 may be
done in a single write to RTCCON. However, if RTCEN = 1, this bit must first be cleared before updating RTCS1-0.
2003 Dec 8
RTCL
LSB
23-bit down counter
RTCF
RTC underflow flag
ERTC
Figure 8-1: Real-time Clock/System Timer block diagram
Power-On
Reset
RTC Reset
7-bit prescaler
÷
128
RTCEN
RTCS1 RTCS2
RTC clk select
RTC Enable
47
User's Manual - Preliminary -
P89LPC920/921/922
XTAL2
XTAL1
Low freq.
Med. freq.
High freq.
CCLK
Int. Osc's

Advertisement

Table of Contents
loading

This manual is also suitable for:

P89lpc921P89lpc922

Table of Contents