SlideShare a Scribd company logo
The 8051 Microcontroller
Chapter 5
SERIAL PORT OPERATION
2/21
• The essential function : parallel to serial
conversion for output data and serial to parallel
conversion for input data
• Full duplex
• Receive buffer
• The serial port buffer (SBUF) is really 2 buffers
• Writing to SBUF loads data to be transmitted,
write-only register
• Reading SBUF accesses received data, read-only
register
• SCON – serial port control register, control bits
and status bits
• Baud rate can be fixed or variable
3/21
4/21
5/21
• Mode of operation of serial port is set by writing
to the SCON at address 99H
6/21
8-bit Shift Register (Mode 0)
• The RXD line for input and output data
• The TXD line serves as the clock
7/21
• Reception: reception enable bit REN=1 and
receive interrupt bit RI=0
8/21
8-bit Shift register (mode 0)
• Possible application is to expand the output
capability of the 8051
9/21
8-bit UART with Variable Baud
Rate (Mode 1)
• Universal Asynchronous
Receiver/Transmitter
• Receives and transmits serial data with each
data character preceded by a start bit (low)
and followed by a stop bit (high)
• For a receive operation, the stop bit goes
into RB8 in SCON
10/21
8-bit UART (Mode 1)
• Clocking and
synchronizing the
serial port shift
registers in mod 1,
2, 3 is established
by a 4-bit
divide by-16
‑
counter, the output
of which is the baud
rate clock
11/21
8-bit UART (Mode1)
• Transmission is initiated by writing ti SBUF
but does not actually start until the next
rollover of the divide-by-16 counter
supplying the serial port baud rate
• Reception is initiated by a 1 to 0 transition
on RXD
• The receiver includes “false start bit
detection”
12/21
• Eleven bits are transmitted or received: a start bit,8
data bits, a programmable ninth data bit, and a stop
bit
9-bit UART with Fixed Baud Rate
(Mode 2)
13/21
9-bit UART with Variable Baud
Rate (Mode 3)
• Modes 1,2 and 3 are very similar
• The differences lie in the baud rates (fixed
in the 2, variable in modes 1 and 3) and in
the number of data bits( 8 in mode 1, 9 in
modes 2 and 3)
14/21
Initialization and accessing serial
port registers
• Receiver Enable : REN in SCON must be set by
software to enable the reception of characters
• The ninth data bit : The ninth bit transmitted in
modes 2 and 3 must be loaded into TB8 by
software, received bit is placed in RB8
• Interrupt Flags : the receive and transmit
interrupt flags (R1 and T1) in SCON, set by
hardware, must be cleared by software
15/21
Multiprocessor Communication
• Modes 2 and 3 have a
special provision
• When the master want
to send some data to
slaves, it first sends
out an address byte of
target slaves
• The trick is not to use
the ninth data bit after
a link has been
established
16/21
Serial Port Baud Rates
• The baud rate is fixed
in modes 0 and 3
• In mode 0 it is always
the on-chip oscillator
freq. divided by 12
• By default following a
system reset, the mode
2 baud rate is the osci.
freq. divided by 64
• Baud rates in modes 1
and 3 are determined
by the timer 1
overflow rate
17/21
Using timer 1 as the Baud Rate
Clock
• The baud rate is the timer 1 overflow rate divided by 32
• The formula for modes 1 and 3 Baud rate=timer 1
overflow +32
18/21
19/21
20/21
21/21

More Related Content

Similar to 8051f.ppt microcontroller serial port operation (20)

PPTX
Micro c lab8(serial communication)
Mashood
 
PDF
Lecture 10 (serial communication)
cairo university
 
PPT
Seminar on serial communication
Samarth Patel
 
PPT
Lecture 10 _serial_communication
Md Rakibul islam chowdhury
 
PPT
8051 serial communication-UART
Pantech ProLabs India Pvt Ltd
 
PPTX
Serial Communication in 8051
Sudhanshu Janwadkar
 
PPTX
Sereial com. ppt
gaurav5345
 
PPTX
Serial communication in 8051 microcontroller .pptx
tamil arasan
 
PPTX
Serial Communication
UshaRani289
 
PPT
Serial.ppt and it contains all information
shwetasonkar638
 
PPT
Chap10
manishappin
 
PPTX
8051 serial communication1
vijaydeepakg
 
PPTX
Serial communication in LPC2148
sravannunna24
 
PPT
AN INTRODUCTION TO SERIAL PORT INTERFACING
Total Project Solutions
 
PPT
7 serial port
Samarth Patel
 
PDF
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
KanchanPatil34
 
PPTX
The presentation is about USART and serial communication
sinaankhalil
 
PPTX
DATA TRANSFER SCHEMES OF 8085
saravanamanikandan02
 
PPT
8051 microcontroller notes continuous
THANDAIAH PRABU
 
Micro c lab8(serial communication)
Mashood
 
Lecture 10 (serial communication)
cairo university
 
Seminar on serial communication
Samarth Patel
 
Lecture 10 _serial_communication
Md Rakibul islam chowdhury
 
8051 serial communication-UART
Pantech ProLabs India Pvt Ltd
 
Serial Communication in 8051
Sudhanshu Janwadkar
 
Sereial com. ppt
gaurav5345
 
Serial communication in 8051 microcontroller .pptx
tamil arasan
 
Serial Communication
UshaRani289
 
Serial.ppt and it contains all information
shwetasonkar638
 
Chap10
manishappin
 
8051 serial communication1
vijaydeepakg
 
Serial communication in LPC2148
sravannunna24
 
AN INTRODUCTION TO SERIAL PORT INTERFACING
Total Project Solutions
 
7 serial port
Samarth Patel
 
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
KanchanPatil34
 
The presentation is about USART and serial communication
sinaankhalil
 
DATA TRANSFER SCHEMES OF 8085
saravanamanikandan02
 
8051 microcontroller notes continuous
THANDAIAH PRABU
 

More from anushkayadav3011 (7)

PPT
8051 microcontroller timer summary presentation
anushkayadav3011
 
PPT
8051c.ppt microcontroller hardware summary
anushkayadav3011
 
PPT
8051d.ppt microcontroller instruction set summary
anushkayadav3011
 
PPT
8051h.ppt microcontroller Assembly Language Programming
anushkayadav3011
 
PPT
8051 microcontroller ppt-Introduction to microcontrollers
anushkayadav3011
 
PPTX
Microcontroller 8051 features and applications
anushkayadav3011
 
PPT
PPT related to training analyst for investment banking
anushkayadav3011
 
8051 microcontroller timer summary presentation
anushkayadav3011
 
8051c.ppt microcontroller hardware summary
anushkayadav3011
 
8051d.ppt microcontroller instruction set summary
anushkayadav3011
 
8051h.ppt microcontroller Assembly Language Programming
anushkayadav3011
 
8051 microcontroller ppt-Introduction to microcontrollers
anushkayadav3011
 
Microcontroller 8051 features and applications
anushkayadav3011
 
PPT related to training analyst for investment banking
anushkayadav3011
 
Ad

Recently uploaded (20)

PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
PPTX
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
PDF
UNIT-4-FEEDBACK AMPLIFIERS AND OSCILLATORS (1).pdf
Sridhar191373
 
PDF
IoT - Unit 2 (Internet of Things-Concepts) - PPT.pdf
dipakraut82
 
PPTX
Presentation on Foundation Design for Civil Engineers.pptx
KamalKhan563106
 
PPTX
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PDF
Additional Information in midterm CPE024 (1).pdf
abolisojoy
 
PDF
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
PPTX
site survey architecture student B.arch.
sri02032006
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
UNIT-4-FEEDBACK AMPLIFIERS AND OSCILLATORS (1).pdf
Sridhar191373
 
IoT - Unit 2 (Internet of Things-Concepts) - PPT.pdf
dipakraut82
 
Presentation on Foundation Design for Civil Engineers.pptx
KamalKhan563106
 
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Additional Information in midterm CPE024 (1).pdf
abolisojoy
 
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
site survey architecture student B.arch.
sri02032006
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
Ad

8051f.ppt microcontroller serial port operation

  • 1. The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION
  • 2. 2/21 • The essential function : parallel to serial conversion for output data and serial to parallel conversion for input data • Full duplex • Receive buffer • The serial port buffer (SBUF) is really 2 buffers • Writing to SBUF loads data to be transmitted, write-only register • Reading SBUF accesses received data, read-only register • SCON – serial port control register, control bits and status bits • Baud rate can be fixed or variable
  • 5. 5/21 • Mode of operation of serial port is set by writing to the SCON at address 99H
  • 6. 6/21 8-bit Shift Register (Mode 0) • The RXD line for input and output data • The TXD line serves as the clock
  • 7. 7/21 • Reception: reception enable bit REN=1 and receive interrupt bit RI=0
  • 8. 8/21 8-bit Shift register (mode 0) • Possible application is to expand the output capability of the 8051
  • 9. 9/21 8-bit UART with Variable Baud Rate (Mode 1) • Universal Asynchronous Receiver/Transmitter • Receives and transmits serial data with each data character preceded by a start bit (low) and followed by a stop bit (high) • For a receive operation, the stop bit goes into RB8 in SCON
  • 10. 10/21 8-bit UART (Mode 1) • Clocking and synchronizing the serial port shift registers in mod 1, 2, 3 is established by a 4-bit divide by-16 ‑ counter, the output of which is the baud rate clock
  • 11. 11/21 8-bit UART (Mode1) • Transmission is initiated by writing ti SBUF but does not actually start until the next rollover of the divide-by-16 counter supplying the serial port baud rate • Reception is initiated by a 1 to 0 transition on RXD • The receiver includes “false start bit detection”
  • 12. 12/21 • Eleven bits are transmitted or received: a start bit,8 data bits, a programmable ninth data bit, and a stop bit 9-bit UART with Fixed Baud Rate (Mode 2)
  • 13. 13/21 9-bit UART with Variable Baud Rate (Mode 3) • Modes 1,2 and 3 are very similar • The differences lie in the baud rates (fixed in the 2, variable in modes 1 and 3) and in the number of data bits( 8 in mode 1, 9 in modes 2 and 3)
  • 14. 14/21 Initialization and accessing serial port registers • Receiver Enable : REN in SCON must be set by software to enable the reception of characters • The ninth data bit : The ninth bit transmitted in modes 2 and 3 must be loaded into TB8 by software, received bit is placed in RB8 • Interrupt Flags : the receive and transmit interrupt flags (R1 and T1) in SCON, set by hardware, must be cleared by software
  • 15. 15/21 Multiprocessor Communication • Modes 2 and 3 have a special provision • When the master want to send some data to slaves, it first sends out an address byte of target slaves • The trick is not to use the ninth data bit after a link has been established
  • 16. 16/21 Serial Port Baud Rates • The baud rate is fixed in modes 0 and 3 • In mode 0 it is always the on-chip oscillator freq. divided by 12 • By default following a system reset, the mode 2 baud rate is the osci. freq. divided by 64 • Baud rates in modes 1 and 3 are determined by the timer 1 overflow rate
  • 17. 17/21 Using timer 1 as the Baud Rate Clock • The baud rate is the timer 1 overflow rate divided by 32 • The formula for modes 1 and 3 Baud rate=timer 1 overflow +32
  • 18. 18/21
  • 19. 19/21
  • 20. 20/21
  • 21. 21/21