EasyManuals Logo

Intel MCS 51 User Manual

Intel MCS 51
334 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #190 background imageLoading...
Page #190 background image
intelo
8XC51FXHARDWAREDESCRIPTION
Mode 3: 11 bits are transmitted(through TXD) or re-
ceived (~ough ~): a start bit (0), 8 data bits (L.SB
tit), a progremmable9th databit and astop bit(l). In
fa~ Mode 3 is the same as Mode 2 in all respects
except the baud rate. The baud rate in Mode 3 is vari-
able.
In elf four modes, trananmsion is initiated by any in-
struction that uses SBUF es a destination register.Re-
ception is initiatedin Mode Oby the condition RI = O
and REN = 1. Reception is initiated in the other
modes by the incoming startbit if REN = 1.For more
detailed informationon each aerialport mod%referto
the “Hardware Description of the 8051, 8052, and
80C51.”
7.1 Framing Error Detection
Framing ErrorDetection allows the serialport to check
for valid stopbits in modes 1,2, or 3. A missingstop bit
can be caused,for example, by noise on the seriallines,
or transmissionby two CPUSsimukaneously.
If a stop bit is missing, a Freming Errorbit FE is set.
The FE bit can be checked in softwareaftereach recep-
tion to detect canrnunication errors.Once set, the FE
bit must be clearedin software.A valid stop bit will not
clear FE.
The FE bit is located in SCON and sharesthe same bit
addressas SMO.Control bit SMODOin the PCON reg-
ister (location PCON.6) determines whether the SMO
or FE bit is accessed.
If SMODO = O,then accesses to
SCON.7 areto SMO.If SMODO = 1, themaccessesto
SCON.7 are to FE.
7.2 Multiprocessor Communications
Modes 2 and 3 provide a 9-bit mode to facilitatemuki-
proceasorcomunicetion. The 9th bit allows the control-
ler to distinguish between eddress and date bytes. The
9th bit is set to 1 for addressbytes and set to Ofor data
bytes. When receiving, the 9th bit goes into RB8 in
SCON. When transmitting, TB8 is set or cleared in
softwere.
The amid port can be programmedsuch that when the
stop bit is receivedthe serialport interruptwill be acti-
vated ordyif the received byte is an addressbyte (RB8
=
1).ThisfeatureisenabledbysettingtheSM2bitin
SCON. A way to use this featurein multipr
oceesorsys-
tems is es follows.
Wherethe masterprocessorwants to transmita block of
data to one of several slaves, it first sends out an ad-
dress byte which identities the targetslave.
Remember,
anaddress
byte has its 9th bit set to 1, whereasa data
byte has its 9th bit set to O.All the slave processors
should have their SM2 bits set to 1 so they will only be
interruptedby an addreasbyte. In fact, the C51FX has
an Automatic Address Recognition feature which al-
lows only the addreasedslaveto be interrupted.That k+
the addreascomparison occurs in hardware, not aoft-
ware. (On the 8051 serial port, an address byte inter-
rupts all slaveafor an addresscomparison.)
The addressed slave’ssoftwarethen clears its SM2 bit
and preparesto receivethe data bytes that wilf be com-
ing. The other
slaves are unaffected by these &ta byt~.
They are still waiting to be addressedsince their SM2
bits are all set.
7.3 Automatic Address Recognition
Automatic Address Recognition reduces the CPU time
required to seMce the serial port. Since the CPU is
only interrupted when it receives its own address, the
software overhead to compare addresses is eliminated.
With this f=ture enabledin one of the 9-bit modes, the
Receive Interrupt (RI) flag wilI only get set when the
received byte correspondsto either a Given or Broad-
cast address.
The feature works the same way in the 8-bit mode
(Mode 1)es in the 9-bit modes, except that the stop bit
takeathe place of the 9th data bit. If SM2 is set, the RI
flag is set ordyif the receivedbyte matches the Given or
Broadcast Address and is termina
ted by a valid stop
bit. Setting the SM2 bit has no effect in Mode O.
The mastercan Selectivelycommunicatewith groups of
slaves by using the Given Address. Addressing all
slaves at once is possible with the Broadcast Addreas.
These addressesare defimxlfor each slave by two Spe-
cial Function Registers:SADDR and SADEN.
A slave’s individual address is specifkd in SADDR
SADEN is a mask byte that definesdon’t-caresto form
the Given Address. Theae don’t-cam alfow flexibility
in the userdetined protocol to address one or more
slavesat a time. The following is an example of how the
user could define Given Addreases to selectively ad-
dress dithrent slaves.
Stave 1:
SADDR =
1111 0001
SADEN =
1111 1010
GIVEN =
1111 oxox
Slave 2:
SADDR =
1111 0011
SADEN =
1111 1001
GIVEN =
1111 Oxxl
5-28

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel MCS 51 and is the answer not in the manual?

Intel MCS 51 Specifications

General IconGeneral
BrandIntel
ModelMCS 51
CategoryMicrocontrollers
LanguageEnglish

Related product manuals