P0.0 to P0.7I/OPort 0: Port 0 is an 8-bit I/O port with a user-configurable
P0.0/CMP2/
KBI0/AD05
LQFP48PLCC44LQFP44
output type. During reset Port 0 latches are configured in the
input only mode with the internal pull-up disabled. The
operation of Port 0 pins as inputs and outputs depends upon
the port configuration selected. Each port pin is configured
independently. Refer to Section 5.1 “
The Keypad Interrupt feature operates with Port 0 pins.
All pins have Schmitt triggered inputs.
Port 0 also provides various special functions as described
I/OT1 — Timer/counter 1 external count input or overflow
output.
IKBI7 — Keyboard input 7.
Port 1: Port 1 is an 8-bit I/O port with a user-configurable
[1]
output type, except for three pins as noted below. During
reset Port 1 latches are configured in the input only mode
with the internal pull-up disabled. The operation of the
configurable Port 1 pins as inputs and outputs depends upon
the port configuration selected. Each of the configurable port
pins are programmed independently. Refer to Section 5.1
“Port configurations”. P1.2 to P1.3 are open drain when used
as outputs. P1.5 is input only.
All pins have Schmitt triggered inputs.
Port 1 also provides various special functions as described
P1.2/T0/SCL282I/OP1.2 — Port 1 bit 2 (open-drain when used as output).
I/OT0 — Timer/counter 0 external count input or overflow output
(open-drain when used as output).
2
C-bus serial clock input/output.
— External interrupt 0 input.
2
C-bus serial data input/output.
— External interrupt 1 input.
— External Reset input during power-on or maybe a
P1.3/INT0
P1.4/INT1
P1.5/RST
I/OSCL — I
/SDA171I/OP1.3 — Port 1 bit 3 (open-drain when used as output).
IINT0
I/OSDA — I
48644I/OP1.4 — Port 1 bit 4.
IINT1
47543IP1.5 — Port 1 bit 5 (input only).
IRST
reset input/output if selected via UCFG1 and UCFG2. When
functioning as a reset input or input/output, a LOW on this
pin resets the microcontroller, causing I/O ports and
peripherals to take on their default states, and the processor
begins execution at address 0. When functioning as a reset
output or input/output an internal reset source will drive this
pin LOW. Also used during a power-on sequence to force
ISP mode. When using an oscillator frequency above
12 MHz, the reset input function of P1.5 must be
enabled. An external circuit is required to hold the
device in reset at power-up until V
has reached its
DD
specified level. When system power is removed VDD will
fall below the minimum specified operating voltage.
When using an oscillator frequency above 12 MHz, in
some applications, an external brownout detect circuit
may be required to hold the device in reset when V
DD
falls below the minimum specified operating voltage.
P1.646442I/OP1.6 — Port 1 bit 6.
P1.7/AD0443240I/OP1.7 — Port 1 bit 7.
IAD04 — ADC0 channel 4 analog input.
P2.0 to P2.5I/OPort 2: Port 2 is an 8-bit I/O port with a user-configurable
output type. During reset Port 2 latches are configured in the
input only mode with the internal pull-up disabled. The
operation of Port 2 pins as inputs and outputs depends upon
the port configuration selected. Each port pin is configured
independently. Refer to Section 5.1 “
Port configurations”.
All pins have Schmitt triggered inputs.
Port 2 also provides various special functions as described
P2.626--I/OP2.6 — Port 2 bit 6.
P2.75--I/OP2.7 — Port 2 bit 7.
P3.0 to P3.1I/OPort 3: Port 3 is a 2-bit I/O port with a user-co n fi g urable
P3.0/XTAL2/
CLKOUT
P3.1/XTAL161 15I/OP3.1 — Port 3 bit 1.
P4.0 to P4.7I/OPort 4: Port 4 is an 8-bit I/O port with a user-configurable
283226I/OP2.4 — Port 2 bit 4.
7126I/OP3.0 — Port 3 bit 0.
…continued
I/OMOSI — SPI master out slave in. When configured as
master, this pin is output; when configured as slave, this pin
is input.
I/OMISO — When configured as master, this pin is input, when
configured as slave, this pin is output.
I/OSS
I/OSPICLK — SPI clock. When configured as master, this pin is
OXTAL2 — Output from the oscillator amplifier (when a crystal
OCLKOUT — CPU clock divided by 2 when enabled via SFR
IXTAL1 — Input to the oscillator circuit and internal clock
— SPI Slave select.
output; when configured as slave, this pin is input.
output type. During reset Port 3 latches are configured in the
input only mode with the internal pull-up disabled. The
operation of Port 3 pins as inputs and outputs depends upon
the port configuration selected. Each port pin is configured
independently. Refer to Section 5.1 “
All pins have Schmitt triggered inputs.
Port 3 also provides various special functions as described
below:
oscillator option is selected via the flash configuration.
bit (ENCLK -TRIM.6). It can be used if the CPU clock is the
internal RC oscillator, watchdog oscillator or external clock
input, except when XTAL1/XT AL2 are used to generate clock
source for the RTC/system timer.
generator circuits (when selected via the flash configuration).
It can be a port pin if internal RC oscillator or watchdog
oscillator is used as the CPU clock source, and if
XTAL1/XTAL 2 a re no t used to generate the clock for the
RTC/system timer.
output type. During reset Port 4 latches are configured in the
input only mode with the internal pull-up disabled. The
operation of Port 4 pins as inputs and outputs depends upon
the port configuration selected. Each port pin is configured
independently. Refer to Section 5.1 “
All pins have Schmitt triggered inputs.
Port 4 also provides various special functions as described
P4.0253024I/OP4.0 — Port 4 bit 0.
P4.1/TRIG242923I/OP4.1 — Port 4 bit 1.
OTRIG — Debugger trigger output.
P4.2/TXD1232822I/OP4.2 — Port 4 bit 2.
OTXD1 — Transmitter output for serial port 1.
P4.3/RXD1222721I/OP4.3 — Port 4 bit 3.
IRXD1 — Receiver input for serial port 1.
P4.4212620I/OP4.4 — Port 4 bit 4.
P4.5/TDI202519I/OP4.5 — Port 4 bit 5.
I/OTDI — Serial data input/output for debugger interface.
P4.6192418I/OP4.6 — Port 4 bit 6.
P4.7/TCLK182317I/OP4.7 — Port 4 bit 7.
ITCLK — Serial clock input for debugger interface.
P5.0 to P5.7I/OPort 5: Port 5 is an 8-bit I/O port with a user-configurable
output type. During reset Port 5 latches are configured in the
input only mode with the internal pull-up disabled. The
operation of Port 5 pins as inputs and outputs depends upon
the port configuration selected. Each port pin is configured
independently. Refer to Section 5.1 “
Port configurations”.
All pins have Schmitt triggered inputs.
Port 5 also provides various special functions as described
below:
P5.0162115I/OP5.0 — Port 5 bit 0. High current output.
P5.1152014I/OP5.1 — Port 5 bit 1. High current output.
P5.2141913I/OP5.2 — Port 5 bit 2. High current output.
P5.3131812I/OP5.3 — Port 5 bit 3. High current output.
P5.412171 1I/OP5.4 — Port 5 bit 4. High current output.
P5.51 11610I/OP5.5 — Port 5 bit 5. High current output.
P5.610159I/OP5.6 — Port 5 bit 6. High current output.
P5.79148I/OP5.7 — Port 5 bit 7. High current output.
V
SS
17, 453, 2216, 41IGround: 0 V reference.
VREFN44--negative ADC reference voltage
V
DD
8, 3213, 367, 30IPower supply: This is the power supply voltage for normal
operation as well as Idle and Power-down modes.
VREFP33--positive ADC refe rence voltage
[1] Input/output for P1.0 to P1.4, P1.6, P1.7. Input for P1.5.
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
A2HCLKLPEBRRENT1ENT0SRST0-DPS000000 00x0
function
register
Bit addressF7F6F5F4F3F2F1F0
BEH000000 0000
generator 0
rate low
BFH000000 0000
generator 0
rate high
BDH------SBRGS_0BRGEN_000
generator 0
control
ACH--CE1CP1CN1OE1CO1CMF100
control register
ADH--CE2CP2CN2OE2CO2CMF200
control register
95H000000 0000
divide-by-M
control
(2 bytes)
[2]
[1]
[1]
xxxx xx00
xx00 0000
xx00 0000
NXP Semiconductors
P89LPC952/954 User manual
UM10147
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
D4H DBMOD_1INTLO_1CIDIS_1DBISEL_1FE_1BR_1OE_1STINT_1000000 0000
extended
status register
8FH---T1M2---T0M200xxx0 xxx0
auxiliary mode
Bit address8F8E8D8C8B8A8988
MSBLSBHexBinary
[1][6]
[6]
[6]
NXP Semiconductors
011x xx00
0000 0000
0000 0000
P89LPC952/954 User manual
UM10147
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
96HRCCLKENCLKTRIM.5TRIM.4TRIM.3TRIM.2TRIM.1TRIM.0
oscillator trim
register
A7HPRE2PRE1PRE0--WDRUNWDTOFWDCLK
control register
C2H
feed 1
C3H
feed 2
MSBLSBHexBinary
[5] [6]
[4] [6]
NXP Semiconductors
[1] All ports are in input only (high-impedance) state after power-up.
[2] BRGR1_0 and BRGR0_0 must only be written if BRGEN_0 in BRGCON_0 SFR is logic 0. If any are written while BRGEN_0 = 1, the result is unpredictable.
[3] The RSTSRC register reflects the cause of the UM10147 reset. Upon a power-up reset, all reset source flags are cleared except POF and BOF; the power-on reset value is
xx110000.
[4] After reset, the value is 1110 01x1, i.e., PRE2 to PRE0 are all logic 1, WDRUN = 1 and WDCLK = 1. WDTOF bit is logic 1 after watchdog reset and is logic 0 after power-on reset.
Other resets will not affect WDTOF.
[5] On power-on reset, the TRIM SFR is initialized with a factory preprogrammed value. Other resets will not cause initialization of the TRIM register.
[6] The only reset source that affects these SFRs is power-on reset.
P89LPC952/954 User manual
UM10147
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
[1] Extended SFRs are physically located on-chip but logically located in external data memory address space (XDATA). The MOVX A,@DPTR and MOVX @DPTR,A instructions are
used to access these extended SFRs.
[2] BRGR1_1 and BRGR0_1 must only be written if BRGEN_1 in BRGCON_1 SFR is logic 0. If any are written while BRGEN_1 = 1, the result is unpredictable.
P89LPC952/954 User manual
UM10147
NXP Semiconductors
1.4Memory organization
FF00h
FFEFh
1FFFh
1E00h
1C00h
1BFFh
1800h
17FFh
1400h
13FFh
1000h
0FFFh
0C00h
0BFFh
0800h
07FFh
0400h
03FFh
0000h
IAP entry-
points
ISP CODE
(512B)*
SECTOR 7
SECTOR 6
SECTOR 5
SECTOR 4
SECTOR 3
SECTOR 2
SECTOR 1
SECTOR 0
Read-protected
IAP calls only
IDATA routines
entry points for:
-51 ASM. code
-C code
ISP serial loader
entry points for:
-UART (auto-baud)
-I2C, SPI, etc.*
Flexible choices:
-as supplied (UART)
-Philips libraries*
-user-defined
FFEFh
FF1Fh
FF00h
1FFFh
1E00h
entry
points
SPECIAL FUNCTION
REGISTERS
(DIRECTLY ADDRESSABLE)
UM10147
P89LPC952/954 User manual
IDATA (incl. DATA)
128 BYTES ON-CHIP
DATA MEMORY (STACK
AND INDIR. ADDR.)
DATA
128 BYTES ON-CHIP
DATA MEMORY (STACK,
DIRECT AND INDIR. ADDR.)
4 REG. BANKS R[7:0]
data memory
(DATA, IDATA)
002aaa948
Fig 5.P89LPC952 memory map - P89LPC954 is similar
The various P89LPC952/954 memory spaces are as follows:
DATA — 128 bytes of internal data memory space (00h:7Fh) accessed via direct or
indirect addressing, using instruction other than MOVX and MOVC. All or part of the Stack
may be in this area.
IDATA — Indirect Data. 256 bytes of internal data memory space (00h:FFh) accessed via
indirect addressing using instructions other than MOVX and MOVC. All or part of the
Stack may be in this area. This area includes the DATA area and the 128 bytes
immediately above it.
SFR — Special Function Registers. Sele cted CPU registers and peripheral control and
status registers, accessible only via direct addressing.
XDATA — ‘External’ Data or Auxiliary RAM. Duplicates the classic 80C51 64 kB memory
space addressed via the MOVX instruction using the DPTR, R0, or R1. All or part of this
space could be implemented on-chip. The P89LPC952/954 has 256 bytes of on-chip
XDATA memory.
CODE — 64 kB of Code memory space, accessed as part of program execution and via
the MOVC instruction. The P89LPC952/954 has 8 kB/ 16 kB of on-chip Code memory.
Table 4.Data RAM arrangement
TypeData RAMSize (bytes)
DATADirectl y an d indirectly addressable memory128
IDATAIndirectly addressable memory256
XDATAIndirectly addressable using MOVX, MOVC, DPTR, R0, R1256
The P89LPC952/954 is a single-chip microcontroller designed for applications demanding
high-integration, low cost solutions over a wide range of performance requirements. The
P89LPC952/954 is based on a high performance processor architecture that executes
instructions in two to four clocks, six times the rate of standard 80C51 devices. Many
system-level functions have been incorporated into the P89LPC952/954 in order to
reduce component count, board space, and system cost
The P89LPC952/954 uses an enhanced 80C51 CPU which ru ns at six times the spee d of
standard 80C51 devices. A machine cycle consists of two CPU clock cycles, and most
instructions execute in one or two machine cycles.
2.2Clock definitions
The P89LPC952/954 device has several internal clocks as defined below:
OSCCLK — Input to the DIVM clock divider. OSCCLK is selected from one of four clock
sources and can also be optionally divided to a slower frequency (see Figure 6
Section 2.8 “
OSCCLK frequency.
CCLK — CPU clock; output of the DIVM clock divider. There are two CCLK cycles per
machine cycle, and most instructions are executed in one to two machine cycles (two or
four CCLK cycles).
RCCLK — The internal 7.373 MHz RC oscillator output.
PCLK — Clock for the various peripheral devices and is
P89LPC952/954 User manual
CPU Clock (CCLK) modification: DIVM register”). Note: f
CCLK
⁄
.
2
UM10147
and
is defined as the
osc
2.2.1Oscillator Clock (OSCCLK)
The P89LPC952/954 provides several user-selectable oscillator options. This allows
optimization for a range of needs from high precision to lowest possible cost. These
options are configured when the FLASH is programmed and include an on -chip watchdog
oscillator, an on-chip RC oscillator, an oscillator using an external crystal, or an external
clock source. The crystal oscillator can be optimized for low, medium, or high frequency
crystals covering a range from 20 kHz to 18 MHz.
2.2.2Low speed oscillator option
This option supports an external crystal in the range of 20 kHz to 100 kHz. Ceramic
resonators are also supported in this configuration.
2.2.3Medium speed oscillator option
This option supports an external crystal in the range of 100 kHz to 4 MHz. Ceramic
resonators are also supported in this configuration.
2.2.4High speed oscillator option
This option supports an external crystal in the range of 4 MHz to 18 MHz. Ceramic
resonators are also supported in this configuration. When using a clock frequency
above 12 MHz, the reset input function of P1.5 must be enabled. An external circuit
is required to hold the device in reset at power-up until V
specified level. When system power is removed V
specified operating voltage. When using a clock frequency above 12 MHz, in some
applications, an external brownout detect circuit may be required to hold the device
in reset when V
requirements for clock frequencies above 12 MHz do not apply when using the
internal RC oscillator in clock doubler mode.
falls below the minimum specified operating voltage. These
The P89LPC952/954 supports a user-selectable clock output function on the XTAL2 /
CLKOUT pin when the crystal oscillator is not being used. This condition occurs if a
different clock source has been selected (on-chip RC oscillator, watchdog oscillator,
external clock input on X1) and if the Real-time Clock is not using the crystal oscillator as
its clock source. This allows external devices to synchronize to the P89LPC9 52/954 . This
output is enabled by the ENCLK bit in the TRIM register
UM10147
P89LPC952/954 User manual
The frequency of this clock output is
1
⁄
that of the CCLK. If the clock output is not needed
2
in Idle mode, it may be turned off prior to entering Idle, saving additional power. Note: on
reset, the TRIM SFR is initialized with a factory preprogrammed value. Therefore when
setting or clearing the ENCLK bit, the user should retain the contents of other bits of the
TRIM register. This can be done by reading the contents of the TRIM register (into the
ACC for example), modifying bit 6, and writing this result back into the TRIM register.
Alternatively, the ‘ANL direct’ or ‘ORL direct’ instructions can be used to clear or set bit 6
of the TRIM register.
2.4On-chip RC oscillator option
The P89LPC952 has a 6-bit TRIM register that can be used to tune the frequency of the
RC oscillator. During reset, the TRIM value is initialized to a factory pre-programmed
value to adjust the oscillator frequency to 7.373 MHz ± 1 % at room temperature. (Note:
the initial value is better than 1 %; please refer to the P89LPC952/954 data sheet for
behavior over temperature). End user applications can write to the TRIM register to adjust
the on-chip RC oscillator to other frequencies. Increasing the TRIM value will decrease
the oscillator frequency. When the clock doubler option is enabled (UCFG1.3 = 1), the
output frequency is doubled. If CCLK is 8 MHz or slower, the CLKLP SFR bit (AUXR1.7)
can be set to logic 1 to reduce power consumption. On reset, CLKLP is logic 0 allowing
highest performance access. This bit can then be se t in software if CCLK is runni ng at
8 MHz or slower.
The requirements in Section 2.2.4 “
an external reset input and using an external reset circuit when the clock freq uency is
greater than 12 MHz do not apply when using the internal RC oscillator’s clock doubler
option.
Table 5.On-chip RC oscillator trim register (TRIM - address 96h) bit allocation
Bit76543210
SymbolRCCLKENCLKTRIM.5TRIM.4TRIM.3TRIM.2TRIM.1TRIM.0
Reset00Bits 5:0 loaded with factory stored value during reset.
High speed oscillator option” for configuring P1.5 as
Table 6.On-chip RC oscillator trim register (TRIM - address 96h) bit description
Bit SymbolDescription
0TRIM.0Trim value. Determines the frequency of the internal RC oscillator. During reset,
1TRIM.1
2TRIM.2
3TRIM.3
4TRIM.4
5TRIM.5
6ENCLKwhen = 1,
7RCCLKwhen = 1, selects the RC Oscillator output as the CPU clock (CCLK). This allows for
these bits are loaded with a stored factory calibration value. When writing to either
bit 6 or bit 7 of this register, care should be taken to preserve the current TRIM value
by reading this register, modifying bits 6 or 7 as required, and writing the result to
this register.
CCLK
⁄
is output on the XTAL2 pin provided the crystal oscillator is not
being used.
fast switching between any clock source and the internal RC oscillator without
needing to go through a reset cycle.
2
2.5Watchdog oscillator option
The watchdog has a separate oscillator which has a frequency of 400 kHz. This oscillator
can be used to save power when a high clock frequency is not needed.
2.6External clock input option
In this configuration, the processor clock is derived from an external source driving the
XT AL1 / P3.1 pin. The rate may be from 0 Hz up to 18 MHz. The XTAL2 / P3.0 pin may be
used as a standard port pin or a clock output.
When using an external clock input frequency above 12 MHz, the reset input
function of P1.5 must be enabled. An external circuit is required to hold the device
in reset at power-up until V
removed V
will fall below the minimum specified operating voltage. When using
DD
has reached its specified level. When syst em power is
DD
an external clock input frequency above 12 MHz, in some applications, an external
brownout detect circuit may be required to hold the device in reset when V
DD
falls
below the minimum specified operating voltage. These requirements for clock
frequencies above 12 MHz do not apply when using the internal RC oscillator in
clock doubler mode.
Note: The oscillator must be configured in one of the following modes: Low frequency crystal,
medium frequency crystal, or high frequency crystal.
(1) A series resistor may be required to limit crystal drive levels. This is especially important for low
frequency crystals (see text).
XTAL1
XTAL2
RC OSCILLATOR
WITH CLOCK DOUBLER
(7.3728 MHz/14.7456 MHz ± 1 %)
(400 kHz +30 % −20 %)
HIGH FREQUENCY
MEDIUM FREQUENCY
LOW FREQUENCY
WATCHDOG
OSCILLATOR
RCCLK
OSCCLK
TIMER 0 AND
DIVM
TIMER 1
RCCLK
PCLK
RTC
ADC0
CCLK
÷2
PCLK
SPI
CPU
WDT
UARTSI2C-BUS
002aab409
Note: The oscillator must be configured in one of the following modes: Low frequency crystal, medium frequency crystal, or high
frequency crystal.
(1) A series resistor may be required to limit crystal drive levels. This is especially important for low frequency crystals (see text).
Fig 7.Block diagram of oscillator control.
2.7Oscillator Clock (OSCCLK) wake-up delay
The P89LPC952/954 has an internal wake-up timer that delays the clock until it stabilizes
depending to the clock source used. If the clock source is any of the three crystal
selections, the delay is 992 OSCCLK cycles plus 60 μs to 100 μs. If the clock source is
either the internal RC oscillator or the Watchdog oscillator, the delay is 224 OSCCLK
cycles plus 60 μs to 100 μs.
The OSCCLK frequency can be divided down, by an integer, up to 510 times by
configuring a dividing register, DIVM, to provide CCLK. This produces the CCLK
frequency using the following formula:
UM10147
P89LPC952/954 User manual
Where: f
Since N ranges from 0 to 255, the CCLK frequency can be in the range of f
(for N = 0, CCLK = f
This feature makes it possible to temporarily run the CPU at a lower rate, reducing power
consumption. By dividing the clock, the CPU can retain the ability to respond to events
other than those that can cause interrupts (i.e. events that allow exiting the Idle mode) by
executing its normal program at a lower rate. This can often result in lower power
consumption than in Idle mode. This can allow bypassing the oscillator start-up time in
cases where Power-down mode would otherwise be used. The value of DIVM may be
changed by the program at any time without interrupting code execution.
2.9Low power select
The P89LPC952/954 is designed to run at 18 MHz (CCLK) maximum. However, if CCLK
is 8 MHz or slower, the CLKLP SFR bit (AUXR1.7) can be set to a logic 1 to lower the
power consumption further. On any reset, CLKLP is logic 0 allowing highest performance.
This bit can then be set in software if CCLK is running at 8 MHz or slower.
3.A/D converter
CCLK frequency = f
is the frequency of OSCCLK, N is the value of DIVM.
osc
osc
osc
).
/ (2N)
osc
to f
osc
/510.
3.1General description
The P89LPC952/954 has a 10-bit, 8-channel multiplexed successive approximation
analog-to-digital converter module. A block diagram of the A/D converter is shown in
Figure 8
providing an input signal to one of two comp arator inpu ts. The contro l logic in combinati on
with the SAR drives a digital-to-analog converter which provides the other input to the
comparator. The output of the comparator is fed to the SAR.
. The A/D consists of an 8-input multiplexer which feeds a sample-and-hold circuit
A single input channel can be selected for conversion. A single conversion will be
performed and the result placed in the result register pair which corresponds to the
selected input channel (see Table 7
conversion completes. The input channel is selected in the ADINS register. This mode is
selected by setting the SCAN0 bit in the ADMODA register.
T able 7.Input channels and result registers for fixed channel single, auto scan single, and
auto scan continuous conversion modes
Result registerInput channelResult registerInput channel
A single input channel can be selected for continuous conversion. The results of the
conversions will be sequentially placed in the eight result register pairs (see Table 8
user may select whether an interrupt can be generated after every four or every eight
). An interrupt, if enabled, will be generated after the
conversions. Additional conversion results will again cycle through the result register
pairs, overwriting the previous results. Continuous conversions continue until terminated
by the user. This mode is selected by setting the SCC0 bit in the ADMODA register.
T able 8.Result registers and conversion results for fixed channel, continuous conversion
Result registerContains
AD0DAT0R/LSelected channel, first conversion result
AD0DAT1R/LSelected channel, second conversion result
AD0DAT2R/LSelected channel, third conversion result
AD0DAT3R/LSelected channel, fourth conversion result
AD0DAT4R/LSelected channel, fifth conversion result
AD0DAT5R/LSelected channel, sixth conversion result
AD0DAT6R/LSelected channel, seventh conversion result
AD0DAT7R/LSelected channel, eighth conversion result
3.2.1.3Auto scan, single conversion mode
Any combination of the eight input channels can be selected for conversion by setting a
channel’s respective bit in the ADINS register. A single conversion of each selected input
will be performed and the result placed in the result register pair which corresponds to the
selected input channel (see Table 7
enabled, will be generated after either the first four conversions have occurred or all
selected channels have been converted. If the user selects to generate an interrupt after
the first four input channels have been converted, a second interrupt will be generated
after the remaining input channels have been converted. If only a single channel is
selected this is equivalent to single channel, single conversion mode. The channels are
converted from LSB to MSB order (in ADINS). This mode is selected by setting the
SCAN0 bit in the ADMODA register.
UM10147
P89LPC952/954 User manual
mode
). The user may select whether an interrupt, if
3.2.1.4Auto scan, continuous conversion mode
Any combination of the eight input channels can be selected for conversion by setting a
channel’s respective bit in the ADINS register. A conversion of each selected input will be
performed and the result placed in the result register pair which corresponds to the
selected input channel (See Table 7
). The user may select whether an interrupt, if
enabled, will be generated after either the first four conversions have occurred or all
selected channels have been converted. If the user selects to generate an interrupt after
the four input channels have been converted, a second interrupt will be generated after
the remaining input channels have been converted. Afte r all selected channels have been
converted, the process will repeat starting with the first selected channel. Additional
conversion results will again cycle through the eight result register pairs, overwriting the
previous results. Continuous conversions continue until terminated by the user. The
channels are converted from LSB to MSB order (in ADINS). This mode is selected by
setting the BURST0 bit in the ADMODA register.
3.2.1.5Dual channel, continuous conversion mode
This is a variation of the auto scan continuous conversion mode where conversio n occurs
on two user-selectable inputs. Any combination of two of the eight input channels can be
selected for conversion. The result of the conversion of the first channel is placed in the
result register pair, AD0DAT0R and AD0DAT0L. The result of the conversion of the
second channel is placed in result register pair, AD0DAT1R and AD0DAT1L. The first
channel is again converted and its result stored in AD0DAT2R and AD0DAT2L. The
second channel is again converted and its result placed in AD0DAT3R and AD0DAT3L,
etc. (see Table 9
conversions (user selectable). This mode is selected by setting the SCC0 bit in the
ADMODA register.
Table 9.Result registers and conversion results for dual channel, continuous conversion
Result registerContains
AD0DAT0R/LFirst channel, first conversion result
AD0DAT1R/LSecond channel, first conversion result
AD0DAT2R/LFirst channel, second conversion result
AD0DAT3R/LSecond channel, second conversion result
AD0DAT4R/LFirst channel, third conversion result
AD0DAT5R/LSecond channel, third conversion result
AD0DAT6R/LFirst channel, fourth conversion result
AD0DAT7R/LSecond channel, fourth conversion result
UM10147
P89LPC952/954 User manual
). An interrupt is generated, if enabled, after every set of four or eight
mode
3.2.1.6Single step mode
This special mode allows ‘single-stepping’ in an auto scan conversion mode. Any
combination of the eight input channels can be selected for conversion. After each
channel is converted, an interrupt is generated, if enabled, and the A/D waits for the next
start condition. The result of each channel is placed in the result register which
corresponds to the selected input channel (See Table 7
start modes. This mode is selected by clearing the BURST0, SCC0, and SCAN0 bits in
the ADMODA register.
3.2.2Conversion mode selection bits
The A/D uses three bits in ADMODA to select the conversio n mode . T hese mod e bits are
summarized in Table 10
combinations shown, are undefined.
Table 10.Conversion mode bits
Burst0SCC0Scan0ADC0 conversion mode
000Single step
001Fixed channel, single
010Fixed channel, continuous
100Auto scan, continuous
,below. Combinations of the three bits, other than the
An A/D conversion is started by the overflow of Timer 0. Once a conversion has started,
additional Timer 0 triggers are ignored until the conversion has completed. The Timer
triggered start mode is available in all A/D operating modes.This mode is selected by the
TMMx bit and the ADCS01 and ADCS00 bits (see Table 12
3.2.3.2Start immediately
Programming this mode immediately start s a conversion.Th is start mode is avai lable in all
A/D operating modes.This mode is selected by setting the ADCS01 and ADCS00 bits in
the ADCON0 register (See Table 12
3.2.3.3Edge triggered
An A/D conversion is started by rising or falling edge of P1.4. Once a conversion has
started, additional edge triggers are ignored until th e conversion has completed. The edge
triggered start mode is available in all A/D operating modes.This mode is selected by
setting the ADCS01 and ADCS00 bits in the ADCON0 register (See Table 12
Table 14
UM10147
P89LPC952/954 User manual
and Table 14).
and Table 14).
and
).
3.2.4Stopping and restarting conversions
An A/D conversion or set of conversions can be stopped by clearing the ADCS01 and
ADCS00 bits in ADCON0 (and also theTMM0 bit in ADCON0 if the conversion was started
in Timer triggered mode). Prior to resuming conversions, the user will need to reset the
input multiplexer to the first user specified channel. This can be accomplished by writing
the ADINS register with the desired channels.
3.2.5Boundary limits interrupt
The A/D converter has both a high and low boundary limit register. The user may select
whether an interrupt is generated when the conversion result is within (or equal to) the
high and low boundary limits or when the conversion result is out side the boun da ry limits.
An interrupt will be generated, if enabled, if the result meets the selected interrupt criteria.
The boundary limit may be disabled by clearing the boundary limit interrupt enable.
An early detection mechanism exists when the interrupt criteria has been selected to be
outside the boundary limits. In this case, after the four MSBs have been converted, these
four bits are compared with the fo ur MSBs of the boundary high and low registers. If the
four MSBs of the conversion meet the interrupt criteria (i.e.- outside the boundary limits)
an interrupt will be generated, if enabled. If the four MSBs do not meet the interrupt
criteria, the boundary limits will again be comp ared af ter all 8MSBs have been converted.
The boundary status register (BNDSTA0) flags the channels which caused a boundary
interrupt.
3.2.6Clock divider
The A/D converter requires that its internal clock source be in the range of 320 kHz to
9 MHz to maintain accuracy . A programmable clock divider that divides the clock from 1 to
8 is provided for this purpose (See Table 16