Philips Semiconductors
P87LPC778
CMOS single-chip 8-bit microcontroller
Product data Rev. 01 — 31 March 2004 52 of 79
9397 750 12378
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
8.15.6 Baud rates
The baud rate in Mode 0 is fixed: Mode 0 Baud Rate = CPU clock/6. The baud rate in
Mode 2 depends on the value of bit SMOD1 in Special Function Register PCON. If
SMOD1 = 0 (which is the value on reset), the baud rate is
1
32
of the CPU clock
frequency. If SMOD1 = 1, the baud rate is
1
16
of the CPU clock frequency.
(6)
Table 49: SCON - Serial port control register (address 98H) bit description
Bit Symbol Description
7 FE Framing Error. This bit is set by the UART receiver when an invalid
stop bit is detected. Must be cleared by software. The SMOD0 bit
in the PCON register must be ‘1’ for this bit to be accessible. See
SM0 bit below.
SM0 With SM1, defines the serial port mode. The SMOD0 bit in the
PCON register must be ‘0’ for this bit to be accessible. See FE bit
above.
6 SM1 With SM0, defines the serial port mode (see Ta ble 50 below).
5 SM2 Enables the multiprocessor communication feature in Modes 2 and
3. In Mode 2 or 3, if SM2 is set to ‘1’, then Rl will not be activated if
the received 9th data bit (RB8) is 0. In Mode 1, if SM2 = 1 then RI
will not be activated if a valid stop bit was not received. In Mode 0,
SM2 should be ‘0’.
4 REN Enables serial reception. Set by software to enable reception.
Clear by software to disable reception.
3 TB8 The 9th data bit that will be transmitted in Modes 2 and 3. Set or
clear by software as desired.
2 RB8 In Modes 2 and 3, is the 9th data bit that was received. In Mode 1,
it SM2 = 0, RB8 is the stop bit that was received. In Mode 0, RB8
is not used.
1 TI Transmit interrupt flag. Set by hardware at the end of the 8th bit
time in Mode 0, or at the beginning of the stop bit in the other
modes, in any serial transmission. Must be cleared by software.
0 RI Receive interrupt flag. Set by hardware at the end of the 8th bit
time in Mode 0, or halfway through the stop bit time in the other
modes, in any serial reception (except see SM2). Must be cleared
by software.
Table 50: SM0, SM1 serial port mode
SM0, SM1 UART mode Baud rate
0 0 0: shift register CPU clock/6
0 1 1: 8-bit UART variable (see text)
1 0 2: 9-bit UART CPU clock/32 or CPU clock/16
1 1 3: 9-bit UART variable (see text)
Mode 2 baud rate
1 SMOD1+
32
------------------------------
CPU clock frequency×=
Philips Semiconductors
P87LPC778
CMOS single-chip 8-bit microcontroller
Product data Rev. 01 — 31 March 2004 53 of 79
9397 750 12378
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
8.15.7 Using Timer1 to generate baud rates
When Timer1 is used as the baud rate generator, the baud rates in Modes 1 and 3
are determined by the Timer1 overflow rate and the value of SMOD1. The Timer1
interrupt should be disabled in this application. The Timer itself can be configured for
either ‘timer’ or ‘counter’ operation, and in any of its 3 running modes. In the most
typical applications, it is configured for ‘timer’ operation, in the auto-reload mode (high
nibble of TMOD = 0010b). In that case the baud rate is given by the formula:
(7)
Tables 51 and 52 list various commonly used baud rates and how they can be
obtained using Timer1 as the baud rate generator.
Mode 1, 3 baud rate
CPU clock frequency / 192 (or 96 if SMOD 1 = 1)
256 TH1()
-------------------------------------------------------------------------------------------------------------------------
=
Table 51: Baud rates, timer values, and CPU clock frequencies for SMOD1 = 0
Timer Count Baud Rate
2400 4800 9600 19.2 k 38.4 k 57.6 k
1 0.4608 0.9216 * 1.8432 * 3.6864 * 7.3728 * 11.0592
2 0.9216 1.8432 * 3.6864 * 7.3728 * 14.7456
3 1.3824 2.7648 5.5296 * 11.0592 - -
4 * 1.8432 * 3.6864 * 7.3728 * 14.7456 - -
5 2.3040 4.6080 9.2160 * 18.4320 - -
6 2.7648 5.5296 * 11.0592 - - -
7 3.2256 6.4512 12.9024 - - -
8 * 3.6864 * 7.3728 * 14.7456 - - -
9 4.1472 8.2944 16.5888 - - -
10 4.6080 9.2160 * 18.4320 - - -
Table 52: Baud rates, timer values, and CPU clock frequencies for SMOD1 = 1
Timer Value Baud Rate
2400 4800 9600 19.2 k 38.4 k 57.6 k 115.2 k
1 0.2304 0.4608 0.9216 * 1.8432 * 3.6864 5.5296 * 11.0592
2 0.4608 0.9216 * 1.8432 * 3.6864 * 7.3728 * 11.0592 -
3 0.6912 1.3824 2.7648 5.5296 * 11.0592 16.5888 -
4 0.9216 * 1.8432 * 3.6864 * 7.3728 * 14.7456 - -
5 1.1520 2.3040 4.6080 9.2160 * 18.4320 - -
6 1.3824 2.7648 5.5296 * 11.0592 - - -
7 1.6128 3.2256 6.4512 12.9024 - - -
8 * 1.8432 * 3.6864 * 7.3728 * 14.7456 - - -
9 2.0736 4.1472 8.2944 16.5888 - - -
10 2.3040 4.6080 9.2160 * 18.4320 - - -
11 2.5344 5.0688 10.1376 - - - -
12 2.7648 5.5296 * 11.0592 - - - -
13 2.9952 5.9904 11.9808 - - - -
14 3.2256 6.4512 12.9024 - - - -
Philips Semiconductors
P87LPC778
CMOS single-chip 8-bit microcontroller
Product data Rev. 01 — 31 March 2004 54 of 79
9397 750 12378
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
[1] Tables 51 and 52 apply to UART modes 1 and 3 (variable rate modes), and show CPU clock rates in MHz for standard baud rates from
2400 to 115.2 kbaud.
[2] Ta bl e 51 shows timer settings and CPU clock rates with the SMOD1 bit in the PCON register = 0 (the default after reset), while Table 5 2
reflects the SMOD1 bit = 1.
[3] The tables show all potential CPU clock frequencies up to 20 MHz that may be used for baud rates from 9600 baud to 115.2 kbaud.
Other CPU clock frequencies that would give only lower baud rates are not shown.
[4] Table entries marked with an asterisk (*) indicate standard crystal and ceramic resonator frequencies that may be obtained from many
sources without special ordering.
8.15.8 More about UART Mode 0
Serial data enters and exits through RxD. TxD outputs the shift clock. 8 bits are
transmitted/received: 8 data bits (LSB first). The baud rate is fixed at
1
6
the CPU
clock frequency. Figure 23 shows a simplified functional diagram of the serial port in
Mode 0, and associated timing.
Transmission is initiated by any instruction that uses SBUF as a destination register.
The ‘write to SBUF’ signal at S6P2 also loads a ‘1’ into the 9th position of the transmit
shift register and tells the TX Control block to commence a transmission. The internal
timing is such that one full machine cycle will elapse between ‘write to SBUF’ and
activation of SEND.
SEND enables the output of the shift register to the alternate output function line of
P3.0 and also enable SHIFT CLOCK to the alternate output function line of P3.1.
SHIFT CLOCK is low during S3, S4, and S5 of every machine cycle, and high during
S6, S1, and S2. At S6P2 of every machine cycle in which SEND is active, the
contents of the transmit shift are shifted to the right one position.
As data bits shift out to the right, zeros come in from the left. When the MSB of the
data byte is at the output position of the shift register, then the ‘1’ that was initially
loaded into the 9th position, is just to the left of the MSB, and all positions to the left of
that contain zeros. This condition flags the TX Control block to do one last shift and
then deactivate SEND and set T1. Both of these actions occur at S1P1 of the 10th
machine cycle after ‘write to SBUF.’ Reception is initiated by the condition REN = 1
and R1 = 0. At S6P2 of the next machine cycle, the RX Control unit writes the bits
11111110 t o the receive shift register, and in the next clock phase activates
RECEIVE.
15 3.4560 6.9120 13.8240 - - - -
16 * 3.6864 * 7.3728 * 14.7456 - - - -
17 3.9168 7.8336 15.6672 - - - -
18 4.1472 8.2944 16.5888 - - - -
19 4.3776 8.7552 17.5104 - - - -
20 4.6080 9.2160 * 18.4320 - - - -
21 4.8384 9.6768 19.3536 - - - -
Table 52: Baud rates, timer values, and CPU clock frequencies for SMOD1 = 1
…continued
Timer Value Baud Rate
2400 4800 9600 19.2 k 38.4 k 57.6 k 115.2 k

P87LPC778FDH,529

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
IC MCU 8BIT 8KB OTP 20TSSOP
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet