Philips Semiconductors Product data
P89C60X2/61X2
80C51 8-bit Flash microcontroller family
64KB Flash, 512B/1024B RAM
2003 Sep 11
28
Table 7. Timer 2 Generated Commonly Used
Baud Rates
Baud Rate Timer 2
12-clk
mode
6-clk
mode
Osc Freq
RCAP2H RCAP2L
375 K 750 K 12 MHz FF FF
9.6 K 19.2 K 12 MHz FF D9
4.8 K 9.6 K 12 MHz FF B2
2.4 K 4.8 K 12 MHz FF 64
1.2 K 2.4 K 12 MHz FE C8
300 600 12 MHz FB 1E
110 220 12 MHz F2 AF
300 600 6 MHz FD 8F
110 220 6 MHz F9 57
Summary Of Baud Rate Equations
Timer 2 is in baud rate generating mode. If Timer 2 is being clocked
through pin T2(P1.0) the baud rate is:
Baud Rate +
Timer 2 Overflow Rate
16
If Timer 2 is being clocked internally, the baud rate is:
Baud Rate +
f
OSC
[n [65536 * (RCAP2H, RCAP2L)]]
Where:
n = 16 in 6-clock mode, 32 in 12-clock mode.
f
OSC
= Oscillator Frequency
To obtain the reload value for RCAP2H and RCAP2L, the above
equation can be rewritten as:
RCAP2H,RCAP2L + 65536 *
ǒ
f
OSC
n Baud Rate
Ǔ
Timer/Counter 2 Set-up
Except for the baud rate generator mode, the values given for
T2CON do not include the setting of the TR2 bit. Therefore, bit TR2
must be set, separately, to turn the timer on. See Table 8 for set-up
of Timer 2 as a timer. Also see Table 9 for set-up of Timer 2 as a
counter.
Table 8. Timer 2 as a Timer
T2CON
MODE
INTERNAL
CONTROL
(Note 1)
EXTERNAL
CONTROL
(Note 2)
16-bit Auto-Reload 00H 08H
16-bit Capture 01H 09H
Baud rate generator receive
and transmit same baud rate
34H 36H
Receive only 24H 26H
Transmit only 14H 16H
Table 9. Timer 2 as a Counter
TMOD
MODE
INTERNAL
CONTROL
(Note 1)
EXTERNAL
CONTROL
(Note 2)
16-bit 02H 0AH
Auto-Reload 03H 0BH
NOTES:
1. Capture/reload occurs only on timer/counter overflow.
2. Capture/reload occurs on timer/counter overflow and a 1-to-0
transition on T2EX (P1.1) pin except when Timer 2 is used in the
baud rate generator mode.
Philips Semiconductors Product data
P89C60X2/61X2
80C51 8-bit Flash microcontroller family
64KB Flash, 512B/1024B RAM
2003 Sep 11
29
FULL-DUPLEX ENHANCED UART
Standard UART operation
The serial port is full duplex, meaning it can transmit and receive
simultaneously. It is also receive-buffered, meaning it can
commence reception of a second byte before a previously received
byte has been read from the register. (However, if the first byte still
hasn’t been read by the time reception of the second byte is
complete, one of the bytes will be lost.) The serial port receive and
transmit registers are both accessed at Special Function Register
SBUF. Writing to SBUF loads the transmit register, and reading
SBUF accesses a physically separate receive register.
The serial port can operate in 4 modes:
Mode 0: Serial data enters and exits through RxD. TxD outputs
the shift clock. 8 bits are transmitted/received (LSB first).
The baud rate is fixed at 1/12 the oscillator frequency (in
12-clock mode) or 1/6 the oscillator frequency (in 6-clock
mode).
Mode 1: 10 bits are transmitted (through TxD) or received
(through RxD): a start bit (0), 8 data bits (LSB first), and
a stop bit (1). On receive, the stop bit goes into RB8 in
Special Function Register SCON. The baud rate is
variable.
Mode 2: 11 bits are transmitted (through TxD) or received
(through RxD): start bit (0), 8 data bits (LSB first), a
programmable 9th data bit, and a stop bit (1). On
Transmit, the 9th data bit (TB8 in SCON) can be
assigned the value of 0 or 1. Or, for example, the parity
bit (P, in the PSW) could be moved into TB8. On receive,
the 9th data bit goes into RB8 in Special Function
Register SCON, while the stop bit is ignored. The baud
rate is programmable to either 1/32 or 1/64 the oscillator
frequency (in 12-clock mode) or 1/16 or 1/32 the
oscillator frequency (in 6-clock mode).
Mode 3: 11 bits are transmitted (through TxD) or received
(through RxD): a start bit (0), 8 data bits (LSB first), a
programmable 9th data bit, and a stop bit (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.
In all four modes, transmission is initiated by any instruction that
uses SBUF as a destination register. Reception is initiated in Mode 0
by the condition RI = 0 and REN = 1. Reception is initiated in the
other modes by the incoming start bit if REN = 1.
Multiprocessor Communications
Modes 2 and 3 have a special provision for multiprocessor
communications. In these modes, 9 data bits are received. The 9th
one goes into RB8. Then comes a stop bit. The port can be
programmed such that when the stop bit is received, the serial port
interrupt will be activated only if RB8 = 1. This feature is enabled by
setting bit SM2 in SCON. A way to use this feature in multiprocessor
systems is as follows:
When the master processor wants to transmit a block of data to one
of several slaves, it first sends out an address byte which identifies
the target slave. An address byte differs from a data byte in that the
9th bit is 1 in an address byte and 0 in a data byte. With SM2 = 1, no
slave will be interrupted by a data byte. An address byte, however,
will interrupt all slaves, so that each slave can examine the received
byte and see if it is being addressed. The addressed slave will clear
its SM2 bit and prepare to receive the data bytes that will be coming.
The slaves that weren’t being addressed leave their SM2s set and
go on about their business, ignoring the coming data bytes.
SM2 has no effect in Mode 0, and in Mode 1 can be used to check
the validity of the stop bit. In a Mode 1 reception, if SM2 = 1, the
receive interrupt will not be activated unless a valid stop bit is
received.
Serial Port Control Register
The serial port control and status register is the Special Function
Register SCON, shown in Figure 14. This register contains not only
the mode selection bits, but also the 9th data bit for transmit and
receive (TB8 and RB8), and the serial port interrupt bits (TI and RI).
Baud Rates
The baud rate in Mode 0 is fixed: Mode 0 Baud Rate = Oscillator
Frequency / 12 (in 12-clock mode) or / 6 (in 6-clock mode). The
baud rate in Mode 2 depends on the value of bit SMOD in Special
Function Register PCON. If SMOD = 0 (which is the value on reset),
and the port pins in 12-clock mode, the baud rate is 1/64 the
oscillator frequency. If SMOD = 1, the baud rate is 1/32 the oscillator
frequency. In 6-clock mode, the baud rate is 1/32 or 1/16 the
oscillator frequency, respectively.
Mode 2 Baud Rate =
2
SMOD
n
(Oscillator Frequency)
Where:
n = 64 in 12-clock mode, 32 in 6-clock mode
The baud rates in Modes 1 and 3 are determined by the Timer 1 or
Timer 2 overflow rate.
Using Timer 1 to Generate Baud Rates
When Timer 1 is used as the baud rate generator (T2CON.RCLK
= 0, T2CON.TCLK = 0), the baud rates in Modes 1 and 3 are
determined by the Timer 1 overflow rate and the value of SMOD as
follows:
Mode 1, 3 Baud Rate =
2
SMOD
n
(Timer 1 Overflow Rate)
Where:
n = 32 in 12-clock mode, 16 in 6-clock mode
The Timer 1 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:
Mode 1, 3 Baud Rate =
2
SMOD
n
Oscillator Frequency
12 [256–(TH1)]
Where:
n = 32 in 12-clock mode, 16 in 6-clock mode
One can achieve very low baud rates with Timer 1 by leaving the
Timer 1 interrupt enabled, and configuring the Timer to run as a
16-bit timer (high nibble of TMOD = 0001B), and using the Timer 1
interrupt to do a 16-bit software reload. Figure 15 lists various
commonly used baud rates and how they can be obtained from
Timer 1.
Philips Semiconductors Product data
P89C60X2/61X2
80C51 8-bit Flash microcontroller family
64KB Flash, 512B/1024B RAM
2003 Sep 11
30
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.
REN Enables serial reception. Set by software to enable reception. Clear by software to disable reception.
TB8 The 9th data bit that will be transmitted in Modes 2 and 3. Set or clear by software as desired.
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.
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.
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.
SM0 SM1 SM2 REN TB8 RB8 TI RI
Where SM0, SM1 specify the serial port mode, as follows:
SM0 SM1 Mode Description Baud Rate
0 0 0 shift register f
OSC
/12 (12-clock mode) or f
OSC
/6 (6-clock mode)
0 1 1 8-bit UART variable
1 0 2 9-bit UART f
OSC
/64 or f
OSC
/32 (12-clock mode) or f
OSC
/32 or f
OSC
/16 (6-clock mode)
1 1 3 9-bit UART variable
SU01626
Bit Addressable
SCON Address = 98H Reset Value = 00H
76543210
Figure 14. Serial Port Control (SCON) Register
Baud Rate
f
SMOD
Timer 1
Mode 12-clock mode 6-clock mode
f
OSC
SMOD
C/T Mode Reload Value
Mode 0 Max 1.67 MHz 3.34 MHz 20 MHz X X X X
Mode 2 Max 625 k 1250 k 20 MHz 1 X X X
Mode 1, 3 Max 104.2 k 208.4 k 20 MHz 1 0 2 FFH
Mode 1, 3 19.2 k 38.4 k 11.059 MHz 1 0 2 FDH
9.6 k 19.2 k 11.059 MHz 0 0 2 FDH
4.8 k 9.6 k 11.059 MHz 0 0 2 FAH
2.4 k 4.8 k 11.059 MHz 0 0 2 F4H
1.2 k 2.4 k 11.059 MHz 0 0 2 E8H
137.5 275 11.986 MHz 0 0 2 1DH
110 220 6 MHz 0 0 2 72H
110 220 12 MHz 0 0 1 FEEBH
Figure 15. Timer 1 Generated Commonly Used Baud Rates
More About 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/12 the oscillator frequency (12-clock mode) or
1/6 the oscillator frequency (6-clock mode).
Figure 16 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 to the receive shift register, and in the next clock phase
activates RECEIVE.
RECEIVE enable SHIFT CLOCK to the alternate output function line
of P3.1. SHIFT CLOCK makes transitions at S3P1 and S6P1 of
every machine cycle. At S6P2 of every machine cycle in which
RECEIVE is active, the contents of the receive shift register are

P89C60X2BA/00,512

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