P89LPC952_954_4 © NXP B.V. 2008. All rights reserved.
Product data sheet Rev. 04 — 24 July 2008 34 of 69
NXP Semiconductors
P89LPC952/954
8-bit microcontroller with 10-bit ADC
7.17.6 Timer overflow toggle output
Timers 0 and 1 can be configured to automatically toggle a port output whenever a timer
overflow occurs. The same device pins that are used for the T0 and T1 count inputs are
also used for the timer toggle outputs. The port outputs will be a logic 1 prior to the first
timer overflow when this mode is turned on.
7.18 RTC/system timer
The P89LPC952/954 has a simple RTC that allows a user to continue running an accurate
timer while the rest of the device is powered down. The RTC can be a wake-up or an
interrupt source. The RTC is a 23-bit down counter comprised of a 7-bit prescaler and a
16-bit loadable down counter. When it reaches all ‘0’s, the counter will be reloaded again
and the RTCF flag will be set. The clock source for this counter can be either the CPU
clock (CCLK) or the XTAL oscillator, provided that the XTAL oscillator is not being used as
the CPU clock. If the XTAL oscillator is used as the CPU clock, then the RTC will use
CCLK as its clock source. Only power-on reset will reset the RTC and its associated SFRs
to the default state.
7.19 UARTs
The P89LPC952/954 has two enhanced UARTs that are compatible with the conventional
80C51 UART except that Timer 2 overflow cannot be used as a baud rate source. The
P89LPC952/954 does include an independent Baud Rate Generator for each UART
(BRG0 for UART 0 and BRG1 for UART 1). The baud rate can be selected from the
oscillator (divided by a constant), Timer 1 overflow, or the independent Baud Rate
Generator associated with the specific UART. In addition to the baud rate generation,
enhancements over the standard 80C51 UART include Framing Error detection,
automatic address recognition, selectable double buffering and several interrupt options.
The UARTs can be operated in 4 modes: shift register, 8-bit UART, 9-bit UART, and CPU
clock/32 or CPU clock/16.
7.19.1 Mode 0
Serial data enters and exits through RXDn. TXDn outputs the shift clock. 8 bits are
transmitted or received, LSB first. The baud rate is fixed at
1
16
of the CPU clock
frequency.
7.19.2 Mode 1
10 bits are transmitted (through TXDn) or received (through RXDn): a start bit (logic 0),
8 data bits (LSB first), and a stop bit (logic 1). When data is received, the stop bit is stored
in RB8_n in Special Function Register SnCON. The baud rate is variable and is
determined by the Timer 1 overflow rate or the Baud Rate Generator (described in Section
7.19.5 “Baud rate generator and selection”).
7.19.3 Mode 2
11 bits are transmitted (through TXDn) or received (through RXDn): start bit (logic 0),
8 data bits (LSB first), a programmable 9
th
data bit, and a stop bit (logic 1). When data is
transmitted, the 9
th
data bit (TB8_n in SnCON) can be assigned the value of ‘0’ or ‘1’. Or,
for example, the parity bit (P, in the PSW) could be moved into TB8_n. When data is
received, the 9
th
data bit goes into RB8_n in Special Function Register SnCON, while the
P89LPC952_954_4 © NXP B.V. 2008. All rights reserved.
Product data sheet Rev. 04 — 24 July 2008 35 of 69
NXP Semiconductors
P89LPC952/954
8-bit microcontroller with 10-bit ADC
stop bit is not saved. The baud rate is programmable to either
1
16
or
1
32
of the CPU clock
frequency, as determined by the SMOD1 bit in PCON. The SMOD1 bit controls the Timer
1 output rate available to both UARTs.
7.19.4 Mode 3
11 bits are transmitted (through TXDn) or received (through RXDn): a start bit (logic 0), 8
data bits (LSB first), a programmable 9
th
data bit, and a stop bit (logic 1). In fact, Mode 3 is
the same as Mode 2 in all respects except baud rate. The baud rate in Mode 3 is variable
and is determined by the Timer 1 overflow rate or the Baud Rate Generator (described in
Section 7.19.5 “Baud rate generator and selection”).
7.19.5 Baud rate generator and selection
Each enhanced UART has an independent Baud Rate Generator. The baud rate is
determined by a baud-rate preprogrammed into the BRGR1_n and BRGR0_n SFRs
which together form a 16-bit baud rate divisor value that works in a similar manner as
Timer 1 but is much more accurate. If the baud rate generator is used, Timer 1 can be
used for other timing functions.
The UARTs can use either Timer 1 or their respective baud rate generator output (see
Figure 8). Note that Timer T1 is further divided by 2 if the SMOD1 bit (PCON.7) is cleared.
The independent Baud Rate Generators use OSCCLK.
7.19.6 Framing error
Framing error is reported in the status register (SnSTAT). In addition, if SMOD0 (PCON.6)
is ‘1’, framing errors can be made available in SnCON.7 respectively. If SMOD0 is ‘0’,
SnCON.7 is SM0_n. It is recommended that SM0_n and SM1_n (SnCON.7:6) are set up
when SMOD0 is ‘0’.
7.19.7 Break detect
Break detect is reported in the status register (SnSTAT). A break is detected when
11 consecutive bits are sensed LOW. The break detect can be used to reset the device
and force the device into ISP mode.
7.19.8 Double buffering
The UART has a transmit double buffer that allows buffering of the next character to be
written to SnBUF while the first character is being transmitted. Double buffering allows
transmission of a string of characters with only one stop bit between any two characters,
as long as the next character is written between the start bit and the stop bit of the
previous character.
Fig 8. Baud rate sources for UART (Modes 1, 3)
baud rate modes 1 and 3
SBRGS = 1
SBRGS = 0
SMOD1 = 0
SMOD1 = 1
timer 1 overflow
(PCLK-based)
baud rate generator
(CCLK-based)
002aaa897
÷2
P89LPC952_954_4 © NXP B.V. 2008. All rights reserved.
Product data sheet Rev. 04 — 24 July 2008 36 of 69
NXP Semiconductors
P89LPC952/954
8-bit microcontroller with 10-bit ADC
Double buffering can be disabled. If disabled (DBMOD_n, i.e., SnSTAT.7 = 0) , the UART i s
compatible with the conventional 80C51 UART. If enabled, the UART allows writing to
SnBUF while the previous data is being shifted out. Double buffering is only allowed in
Modes 1, 2 and 3. When operated in Mode 0, double buffering must be disabled
(DBMOD_n = 0).
7.19.9 Transmit interrupts with double buffering enabled (Modes 1, 2 and 3)
Unlike the conventional UART, in double buffering mode, the TI_n interrupt is generated
when the double buffer is ready to receive new data.
7.19.10 The 9
th
bit (bit 8) in double buffering (Modes 1, 2 and 3)
If double buffering is disabled TB8_n can be written before or after SnBUF is written, as
long as TB8_n is updated some time before that bit is shifted out. TB8_n must not be
changed until the bit is shifted out, as indicated by the TI_n interrupt.
If double buffering is enabled, TB8_n must be updated before SnBUF is written, as TB8_n
will be double-buffered together with SnBUF data.
7.20 I
2
C-bus serial interface
I
2
C-bus uses two wires (SDA and SCL) to transfer information between devices connected
to the bus, and it has the following features:
Bidirectional data transfer between masters and slaves
Multi master bus (no central master)
Arbitration between simultaneously transmitting masters without corruption of serial
data on the bus
Serial clock synchronization allows devices with different bit rates to communicate via
one serial bus
Serial clock synchronization can be used as a handshake mechanism to suspend and
resume serial transfer
The I
2
C-bus may be used for test and diagnostic purposes.
A typical I
2
C-bus configuration is shown in Figure 9. The P89LPC952/954 device provides
a byte-oriented I
2
C-bus interface that supports data transfers up to 400 kHz.
Fig 9. I
2
C-bus configuration
OTHER DEVICE
WITH I
2
C-BUS
INTERFACE
SDA
SCL
R
PU
R
PU
OTHER DEVICE
WITH I
2
C-BUS
INTERFACE
P1.3/SDA P1.2/SCL
I
2
C MCU
I
2
C-bus
002aab410

P89LPC952FA,512

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
Microcontrollers - MCU 8-bit Microcontrollers - MCU 80C51 8K FL 512B RAM
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union