Real-Time Clock System Timer - Philips P89LPC938 User Manual

Single-chip microcontroller
Table of Contents

Advertisement

Philips Semiconductors
control bits ENT0 and ENT1 in the AUXR1 register, and apply to Timer 0 and Timer 1
respectively. The port outputs will be a logic 1 prior to the first timer overflow when this
mode is turned on. In order for this mode to function, the C/T bit must be cleared selecting
PCLK as the clock source for the timer.

9. Real-time clock system timer

The P89LPC938 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
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 to 15).
RTCL — Real-time Clock counter reload low (bits 14 to 7).
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 logic 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.
RTCH
MSB
Wake-up from power-down
Interrupt if enabled
(shared with WDT)
Fig 20. Real-time clock/system timer block diagram.
User manual
RTCL
Reload on underflow
LSB
23-bit down counter
RTCF
RTC underflow flag
ERTC
Rev. 03 — 7 June 2005
Power-on
reset
RTC Reset
7-bit prescaler
÷ 128
RTCS1 RTCS2
RTCEN
RTC clk select
RTC enable
UM10119
P89LPC938 User manual
Figure
20).
XTAL2 XTAL1
LOW FREQ.
MED. FREQ.
HIGH FREQ.
CCLK
internal
oscillators
002aaa924
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
50 of 139

Advertisement

Table of Contents
loading

Table of Contents