P89CV51RB2_RC2_RD2_3 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 03 — 25 August 2009 37 of 76
NXP Semiconductors
P89CV51RB2/RC2/RD2
80C51 with 1 kB RAM, SPI
6.6.5 Framing error
Framing Error (FE) is reported in the SCON.7 bit if SMOD0 (PCON.6) = 1. If SMOD0 = 0,
SCON.7 is the SM0 bit for the UART, it is recommended that SM0 is set up before SMOD0
is set to 1.
Table 24. SCON - Serial port control register (address 98H) bit allocation
Bit addressable; reset value: 00H.
Bit 7 6 5 4 3 2 1 0
Symbol SM0/FE SM1 SM2 REN TB8 RB8 TI RI
Table 25. SCON - Serial port control register (address 98H) bit description
Bit Symbol Description
7 SM0/FE The usage of this bit is determined by SMOD0 in the PCON register. If
SMOD0 = 0, this bit is SM0, which with SM1, defines the serial port
mode. If SMOD0 = 1, this bit is FE (Framing Error). FE is set by the
receiver when an invalid stop bit is detected. Once set, this bit cannot
be cleared by valid frames but can only be cleared by software. (Note:
It is recommended to set up UART mode bits SM0 and SM1 before
setting SMOD0 to 1.)
6 SM1 With SM0, defines the serial port mode; see
Table 26.
5 SM2 Enables the multiprocessor communication feature in modes 2 and 3.
In Mode 2 or 3, if SM2 is set to 1, then RI 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, if
SM2 = 0, RB8 is the stop bit that was received. In Mode 0, RB8 is
undefined.
1 TI Transmit Interrupt flag. Set by hardware at the end of the 8th bit time in
Mode 0, or at 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 approximately halfway through the stop bit time in all other
modes. (See SM2 for exceptions). Must be cleared by software.
Table 26. SCON - Serial port control register (address 98H) SM0/SM1 mode definition
SM0, SM1 UART mode Baud rate
0 0 0: shift register CPU clock / 6
0 1 1: 8-bit UART variable
1 0 2: 9-bit UART CPU clock / 32 or CPU clock / 16
1 1 3: 9-bit UART variable
P89CV51RB2_RC2_RD2_3 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 03 — 25 August 2009 38 of 76
NXP Semiconductors
P89CV51RB2/RC2/RD2
80C51 with 1 kB RAM, SPI
6.6.6 More about UART Mode 1
Reception is initiated by a detected 1-to-0 transition at RXD. For this purpose RXD is
sampled at a rate of 16 times whatever baud rate has been established. When a transition
is detected, the divide-by-16 counter is immediately reset to align its roll-overs with the
boundaries of the incoming bit times.
The 16 states of the counter divide each bit time into 16ths. At the 7th, 8th, and 9th
counter states of each bit time, the bit detector samples the value of RXD. The value
accepted is the value that was seen in at least 2 of the 3 samples. This is done for noise
rejection. If the value accepted during the first bit time is not 0, the receive circuits are
reset and the unit goes back to looking for another 1-to-0 transition. This is to provide
rejection of false start bits. If the start bit proves valid, it is shifted into the input shift
register, and reception of the rest of the frame will proceed.
The signal to load SBUF and RB8, and to set RI, will be generated if, and only if, the
following conditions are met at the time the final shift pulse is generated: (a) RI = 0, and
(b) either SM2 = 0, or the received stop bit = 1.
If either of these two conditions is not met, the received frame is irretrievably lost. If both
conditions are met, the stop bit goes into RB8, the 8 data bits go into SBUF, and RI is
activated.
6.6.7 More about UART Modes 2 and 3
Reception is performed in the same manner as in Mode 1.
The signal to load special function register SBUF and RB8, and to set RI, will be
generated if, and only if, the following conditions are met at the time the final shift pulse is
generated: (a) RI = 0, and (b) either SM2 = 0, or the received 9th data bit = 1.
If either of these conditions is not met, the received frame is irretrievably lost, and RI is not
set. If both conditions are met, the received 9th data bit goes into RB8, and the first 8 data
bits go into SBUF.
6.6.8 Multiprocessor communications
UART modes 2 and 3 have a special provision for multiprocessor communications. In
these modes, 9 data bits are received or transmitted. When data is received, the 9th bit is
stored in RB8. The UART can be programmed so 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. One 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: 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, i.e. the received 9th bit is 0. However, an address
byte having the 9th bit set to 1 will interrupt all slaves, so that each slave can examine the
received byte to see if it is being addressed or not. The addressed slave will clear its SM2
bit and prepare to receive the data (still 9 bits long) that follow. The slaves that were not
addressed leave their SM2 bits set and ignore the subsequent data bytes.
P89CV51RB2_RC2_RD2_3 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 03 — 25 August 2009 39 of 76
NXP Semiconductors
P89CV51RB2/RC2/RD2
80C51 with 1 kB RAM, SPI
SM2 has no effect in Mode 0, and in Mode 1 can be used to check the validity of the stop
bit, although it is preferable to use the Framing Error flag (FE). When the UART receives
data in Mode 1 and SM2 = 1, the receive interrupt will not be activated unless a valid stop
bit is received.
6.6.9 Automatic address recognition
Automatic address recognition is a feature which allows the UART to recognize certain
addresses in the serial bit stream by using hardware to make the comparisons. This
feature saves a great deal of software overhead by eliminating the need for the software to
examine every serial address which passes by the serial port. This feature is enabled for
the UART by setting the SM2 bit in SCON. In the 9-bit UART modes, Mode 2 and Mode 3,
the Receive Interrupt flag (RI) will be automatically set when the received byte contains
either the ‘given’ address or the ‘broadcast’ address. The 9-bit mode requires that the 9th
information bit is a 1 to indicate that the received information is an address and not data.
Using the automatic address recognition feature allows a master to selectively
communicate with one or more slaves by invoking the given slave address or addresses.
All of the slaves may be contacted by using the broadcast address. Two special function
registers are used to define the slave’s address, SADDR, and the address mask, SADEN.
SADEN is used to define which bits in the SADDR are to be used and which bits are don’t
care. The SADEN mask can be logically ANDed with the SADDR to create the given
address which the master will use for addressing each of the slaves. Use of the given
address allows multiple slaves to be recognized while excluding others.
This device uses the methods presented in Figure 15 to determine if a given or broadcast
address has been received or not.
Fig 15. Schemes used by the UART to detect ‘given’ and ‘broadcast’ addresses when
multiprocessor communications is enabled
002aaa527
rx_byte(7)
saddr(7)
saden(7)
rx_byte(0)
saddr(0)
.
.
.
given_address_match
logic used by UART to detect 'given address' in received data
saddr(7)
saden(7)
rx_byte(7)
saddr(0)
saden(0)
rx_byte(0)
broadcast_address_match
logic used by UART to detect 'given address' in received data
saden(0)
.
.
.

P89CV51RD2FA,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