SlideShare a Scribd company logo
1
Unit 5: 8051 Serial Port Programming
Part 2
Subject: Processor Architecture & Interfacing
(SPPU, Pune 2015 Course of Information Technology)
Class: SEIT Semester: II
Prepared By,
Ms. K. D. Patil, Assistant Professor
Department of Information Technology
(NBA accredited)
Sanjivani College of Engineering, Kopargaon-423603.
Maharashtra, India.
(An Autonomous Institute, Affiliated with SPPU, Pune.)
NAAC ‘A’ Grade Accredited, ISO 9001:2015 certified
Contents
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
2
 Part 1
 Basics of Communication
 Serial Vs Parallel communication
 Synchronous Vs Asynchronous communication
 Data Framing in Asynchronous Serial Communication
 Baud Rate
 Part 2
 Special Function Registers
 Operating modes of Serial Communication
 Doubling Baud Rate in 8051
 Part 3
 Importance of TI Flag
 Importance of RI Flag
 Examples
Special Function Registers
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
3
 SBUF (Serial Buffer) Register
 Byte addressable
 SCON (Serial Control) Register
 Bit addressable
 PCON (Power Control) Register
 Byte addressable
SBUF (Serial Buffer) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
4
 Byte Addressable
 SBUF is an 8-bit register used solely for serial communication
 For a byte data to be transferred via the TxD line, it must be placed in the
SBUF register
 The moment a byte is written into SBUF, it is framed with the start and stop
bits and transferred serially via the TxD line
 SBUF holds the byte of data when it is received by 8051 RxD line
 When the bits are received serially via RxD, the 8051 de-frames it by
eliminating the stop and start bits, making a byte out of the data received,
and then placing it in SBUF
 Example:
MOV SBUF, # ’B’ ; load SBUF=42, ASCII for ‘B’
MOV SBUF, A ; copy accumulator into SBUF
MOV A, SBUF ; copy SBUF into accumulator
SCON (Serial Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
5
 SCON is an 8-bit register used to program the start bit, stop bit, and
data bits of data framing, among other things
 Bit addressable
SM0 SM1 SM2 REN TB0 RB0 TI RI
SMO SCON.7 Serial port mode specifier
SM1 SCON.6 Serial port mode specifier
SM2 SCON.5 Used for Multiprocessor Communication
REN SCON.4 Set/cleared by software to enable/disable reception
TB8 SCON.3 Not Widely used
RB8 SCON.2 Not Widely used
TI SCON.1 Transmit interrupt flag. Set by the Hardware at beginning of
stop bit mode 1. Cleared by software
RI SCON.0 Receive interrupt flag. Set by the Hardware halfway through
stop bit mode 1. Cleared by software
SCON (Serial Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
6
 SM0 (SCON.7), SM1(SCON.6)
 They determine the framing of data by specifying the
number of bits per character, and the start and stop
bits
SM0 SM1 Serial Modes
0 0 Serial Mode 0
0 1 Serial Mode 1, 8 Bit data, 1 stop
Bit, 1 start bit
1 0 Serial Mode 2
1 1 Serial Mode 3
Note: Only mode 1 is of our Interest
Serial Modes
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
7
 Serial Mode 1
 Out of 4, only mode 1 is of our interest
 Other 3 modes are rarely used
 Asynchronous (single character at a time)
 Data framing is of 8 bits, 1 stop bit, 1 start bit which
makes it compatible with the COM port of IBM compatible
PCs
 Allows baud rate to be variable and is set by Timer 1 of
8051
 For each character, a total of 10 bits are transferred
where, First bit is start bit, followed by 8 data bits, and
finally 1 stop bit
Serial Modes
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
8
 Serial Mode 0
 Synchronous (Transfers block of character at a time)
 Data transferred on RxD
 Clock on TxD
 Clock is fixed at oscillator frequency
 Serial Mode 2
 Asynchronous (single character at a time)
 Data framing is of 11 bits, 1 stop bit, 1 start bit, 8 data bits
(programmable 9 data bits)
 On transmission TB8 bit of SCON is 9th Bit
 9th Bit may be used for Data or Parity Bit
 Baud rate may be 1/32 or 1/64 of oscillator frequency
 Serial Mode 3
 Same as Serial mode 2 with programmable baud rate
SCON (Serial Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
9
 SM2 (SCON.5)
 This enables the multiprocessing capability of the 8051
 For us, SM2 = 0 as 8051 will not be used in
multiprocessor environment
 REN (SCON.4)
 receive enable
 When REN = 1 (High), it allows 8051 to receive data
on RxD pin
 When REN = 0 (low), the receiver is disable
 Can be used to block any serial data reception
SCON (Serial Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
10
 TB8 (SCON.3)
 Transfer Bit
 Used for Serial modes 2 and 3
 For us, TB8 = 0 as we are using Serial Mode 1 for
programming
 RB8 (SCON.2)
 receive Bit
 Used for Serial modes 2 and 3
 In Serial Mode 1, this bit gets the copy of stop Bit when an
8 bit data is received
 For us, RB8 = 0
SCON (Serial Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
11
 TI (SCON.1)
 transmit interrupt
 When 8051 finishes the transfer of 8-bit character
 It raises TI flag to indicate that it is ready to transfer
another byte
 TI bit is raised at the beginning of the stop bit
 RI (SCON.0)
 When 8051 receives data serially via RxD, it gets rid of
the start and stop bits and places the byte in SBUF register
 It raises the RI flag bit to indicate that a byte has been
received and should be picked up before it is lost
 RI is raised halfway through the stop bit
Doubling Baud Rate in 8051
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
12
 There are two ways to increase the baud rate of
data transfer
 To use a higher frequency crystal
 This is not feasible as System crystal is fixed
 New Crystal Frequency may not be compatible with IBM PC
serial COM’s port baud rate
 To change a bit in the PCON register
PCON (Power Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
13
 It is an 8-bit register
 Byte addressable
 SMOD (Serial mode) bit
 used serial communication
 When 8051 is powered up, SMOD is zero
 We can set it to high by software and the double the baud
rate
SMOD ---- ---- ---- GF1 GF0 PD IDL
D7 D6 D5 D4 D3 D2 D1 D0
PCON (Power Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
14
 Following set of sequence can be used to set high D7
of PCON
MOV A,PCON ;place a copy of PCON in ACC
SETB ACC.7 ;make D7=1
MOV PCON,A ;now SMOD=1 without
;changing any other bits
Note: PCON is byte addressable so cannot directly set
bit D7 to high
PCON (Power Control) Register
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
15
 GF1 and GF0 Bits
 Both are general purpose flag bits
 PD (Power Down) Bit
 Setting this bit activates Power down operation
 Available only in CMOS
 IDL (Idle mode) Bit
 Setting this bit activates Idle mode operation
 Available only in CMOS
Doubling Baud Rate in 8051
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
16
 Considering, XTAL = 11.0592 MHz
 For SMOD = 0
 Machine cycle freq. = 11.0592 MHz / 12 = 921.6 kHz
 Timer 1 frequency to set Baud Rate = 921.6 kHz / 32 = 28800 Hz
 For SMOD = 1
 Machine cycle freq. = 11.0592 MHz / 12 = 921.6 kHz
 Timer 1 frequency to set Baud Rate = 921.6 kHz / 16 = 57,600 Hz
Doubling Baud Rate in 8051
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
17
 Baud Rate Comparison for SMOD = 0 and SMOD = 1
TH1
(Decimal)
TH1
(Hex)
Baud Rate
(SMOD = 0)
Baud Rate
(SMOD = 1)
-3 FD 9600 19200
-6 FA 4800 9600
-12 F4 2400 4800
-24 E8 1200 2400
Reference
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
18
 “The 8051 Microcontroller and Embedded Systems
using Assembly and C” , Muhammad Ali Mazidi,
Janice Gillispie Mazidi, Rolin D. McKinlay, Second
Edition, Pearson publication
Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani
COE, Kopargaon
19

More Related Content

PDF
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
PDF
40120140504012
PDF
IRJET- FPGA based Processor for Feature Detection in Ultra-Wide Band Radar
PDF
Data communication lab manual
PPTX
Serial Communication
PDF
Ln3619761985
PDF
Comparative study of_digital_modulation (1)
PPT
05 signal encodingtechniques
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
40120140504012
IRJET- FPGA based Processor for Feature Detection in Ultra-Wide Band Radar
Data communication lab manual
Serial Communication
Ln3619761985
Comparative study of_digital_modulation (1)
05 signal encodingtechniques

What's hot (20)

PDF
Implementation of Universal Asynchronous Receiver and Transmitter
PDF
Software Design of Digital Receiver using FPGA
PDF
Adc lab
PDF
Identifying PCIe 3.0 Dynamic Equalization Problems
PDF
Serial1
PDF
IEEE_Peer_Reviewed_Paper_1
PDF
ADS Workshop on PCI Express(r)
PDF
IEEE 1588 Timing for Mobile Backhaul_Webinar
PDF
Ff34970973
PDF
4 ijaems nov-2015-4-fsk demodulator- case study of pll application
PDF
Implementation of gps signal acquisition and tracking in fpga
PDF
FPGA Implementation of BIST in OFDM Transceivers
PDF
An Effective Design and Verification Methodology for Digital PLL
PDF
Performance Evaluation of IEEE STD 802.16d Transceiver
PDF
Time Synchronisation
PDF
Bm044394397
PDF
IRJET- A Study on PRN Code Generation and Properties of C/A Code in GPS based...
PDF
iaetsd Software defined am transmitter using vhdl
PPTX
IoT in LTE
PPTX
Design And Simulation of Modulation Schemes used for FPGA Based Software Defi...
Implementation of Universal Asynchronous Receiver and Transmitter
Software Design of Digital Receiver using FPGA
Adc lab
Identifying PCIe 3.0 Dynamic Equalization Problems
Serial1
IEEE_Peer_Reviewed_Paper_1
ADS Workshop on PCI Express(r)
IEEE 1588 Timing for Mobile Backhaul_Webinar
Ff34970973
4 ijaems nov-2015-4-fsk demodulator- case study of pll application
Implementation of gps signal acquisition and tracking in fpga
FPGA Implementation of BIST in OFDM Transceivers
An Effective Design and Verification Methodology for Digital PLL
Performance Evaluation of IEEE STD 802.16d Transceiver
Time Synchronisation
Bm044394397
IRJET- A Study on PRN Code Generation and Properties of C/A Code in GPS based...
iaetsd Software defined am transmitter using vhdl
IoT in LTE
Design And Simulation of Modulation Schemes used for FPGA Based Software Defi...
Ad

Similar to SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2 (20)

PPTX
INTERFACING 8051-MICROCONTROLLER with timer and display
PPTX
8051 serialp port
PDF
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
PPT
12 mt06ped019
PPT
Seminar on serial communication
PPT
Serial.ppt and it contains all information
PPTX
Microcontrollers and microprocessors in electrical communication engineering....
PPTX
DATA TRANSFER SCHEMES OF 8085
PPTX
Serial Communication in 8051
PPTX
Serial communication
PPTX
Sereial com. ppt
PPTX
Serial communication in 8051 microcontroller
PPT
8051 serial communication-UART
PPTX
8051 SERIAL PORTS.pptx
PPTX
Serial data transfer
PPT
8051f.ppt microcontroller serial port operation
PPTX
Presentation On: "Micro-controller 8051 & Embedded System"
PPTX
8051 serial communication1
PDF
Microprocessor 8051
INTERFACING 8051-MICROCONTROLLER with timer and display
8051 serialp port
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
12 mt06ped019
Seminar on serial communication
Serial.ppt and it contains all information
Microcontrollers and microprocessors in electrical communication engineering....
DATA TRANSFER SCHEMES OF 8085
Serial Communication in 8051
Serial communication
Sereial com. ppt
Serial communication in 8051 microcontroller
8051 serial communication-UART
8051 SERIAL PORTS.pptx
Serial data transfer
8051f.ppt microcontroller serial port operation
Presentation On: "Micro-controller 8051 & Embedded System"
8051 serial communication1
Microprocessor 8051
Ad

More from KanchanPatil34 (20)

PDF
Unit 1_Data Validation_Validation Techniques.pdf
PDF
Unit 1_Concet of Feature-Feature Selection Methods.pdf
PDF
Unit 1_Introduction to ML_Types_Applications.pdf
PDF
Unit 6_Cyber Laws Indian Act_Digital Signature.pdf
PDF
Unit 6_DoS and DDoS_SQL Injection_tools.pdf
PDF
Unit 6_keylogger_Spywares_virus_worms.pdf
PDF
Unit 6_Introduction_Phishing_Password Cracking.pdf
PDF
Unit 5_Social Engineering and Cyberstalking.pdf
PDF
Unit 5_Classification of Cyber Crimes.pdf
PDF
Unit 5_Introduction to Cyber Security.pdf
PDF
Unit 4_SSL_Handshake Protocol_Record Layer Protocol.pdf
PDF
Unit 4_IPSec_AH_ESP_IKE_SA_Tunnel_Transport.pdf
PDF
Unit 3_Private Key Management_Protection.pdf
PDF
Unit 3_Kerberos Protocol_Working_Version.pdf
PDF
Unit 3_Digital Certificate_Intro_Types.pdf
PDF
Unit 3_Digital Signature Model Details.pdf
PDF
Unit 3_Hash function and MD5 working.pdf
PDF
Unit 3_Secure Hash Algorithm_SHA_Working.pdf
PDF
AES Solved Example on Encryption all rounds.pdf
PDF
Unit 2_AES_AES_Structure_Encryption_Example.pdf
Unit 1_Data Validation_Validation Techniques.pdf
Unit 1_Concet of Feature-Feature Selection Methods.pdf
Unit 1_Introduction to ML_Types_Applications.pdf
Unit 6_Cyber Laws Indian Act_Digital Signature.pdf
Unit 6_DoS and DDoS_SQL Injection_tools.pdf
Unit 6_keylogger_Spywares_virus_worms.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 5_Social Engineering and Cyberstalking.pdf
Unit 5_Classification of Cyber Crimes.pdf
Unit 5_Introduction to Cyber Security.pdf
Unit 4_SSL_Handshake Protocol_Record Layer Protocol.pdf
Unit 4_IPSec_AH_ESP_IKE_SA_Tunnel_Transport.pdf
Unit 3_Private Key Management_Protection.pdf
Unit 3_Kerberos Protocol_Working_Version.pdf
Unit 3_Digital Certificate_Intro_Types.pdf
Unit 3_Digital Signature Model Details.pdf
Unit 3_Hash function and MD5 working.pdf
Unit 3_Secure Hash Algorithm_SHA_Working.pdf
AES Solved Example on Encryption all rounds.pdf
Unit 2_AES_AES_Structure_Encryption_Example.pdf

Recently uploaded (20)

PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Cell Structure & Organelles in detailed.
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Complications of Minimal Access Surgery at WLH
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial diseases, their pathogenesis and prophylaxis
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Types and Its function , kingdom of life
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Supply Chain Operations Speaking Notes -ICLT Program
A systematic review of self-coping strategies used by university students to ...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharma ospi slides which help in ospi learning
Cell Structure & Organelles in detailed.
Final Presentation General Medicine 03-08-2024.pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Anesthesia in Laparoscopic Surgery in India
Complications of Minimal Access Surgery at WLH

SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2

  • 1. 1 Unit 5: 8051 Serial Port Programming Part 2 Subject: Processor Architecture & Interfacing (SPPU, Pune 2015 Course of Information Technology) Class: SEIT Semester: II Prepared By, Ms. K. D. Patil, Assistant Professor Department of Information Technology (NBA accredited) Sanjivani College of Engineering, Kopargaon-423603. Maharashtra, India. (An Autonomous Institute, Affiliated with SPPU, Pune.) NAAC ‘A’ Grade Accredited, ISO 9001:2015 certified
  • 2. Contents Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 2  Part 1  Basics of Communication  Serial Vs Parallel communication  Synchronous Vs Asynchronous communication  Data Framing in Asynchronous Serial Communication  Baud Rate  Part 2  Special Function Registers  Operating modes of Serial Communication  Doubling Baud Rate in 8051  Part 3  Importance of TI Flag  Importance of RI Flag  Examples
  • 3. Special Function Registers Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 3  SBUF (Serial Buffer) Register  Byte addressable  SCON (Serial Control) Register  Bit addressable  PCON (Power Control) Register  Byte addressable
  • 4. SBUF (Serial Buffer) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 4  Byte Addressable  SBUF is an 8-bit register used solely for serial communication  For a byte data to be transferred via the TxD line, it must be placed in the SBUF register  The moment a byte is written into SBUF, it is framed with the start and stop bits and transferred serially via the TxD line  SBUF holds the byte of data when it is received by 8051 RxD line  When the bits are received serially via RxD, the 8051 de-frames it by eliminating the stop and start bits, making a byte out of the data received, and then placing it in SBUF  Example: MOV SBUF, # ’B’ ; load SBUF=42, ASCII for ‘B’ MOV SBUF, A ; copy accumulator into SBUF MOV A, SBUF ; copy SBUF into accumulator
  • 5. SCON (Serial Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 5  SCON is an 8-bit register used to program the start bit, stop bit, and data bits of data framing, among other things  Bit addressable SM0 SM1 SM2 REN TB0 RB0 TI RI SMO SCON.7 Serial port mode specifier SM1 SCON.6 Serial port mode specifier SM2 SCON.5 Used for Multiprocessor Communication REN SCON.4 Set/cleared by software to enable/disable reception TB8 SCON.3 Not Widely used RB8 SCON.2 Not Widely used TI SCON.1 Transmit interrupt flag. Set by the Hardware at beginning of stop bit mode 1. Cleared by software RI SCON.0 Receive interrupt flag. Set by the Hardware halfway through stop bit mode 1. Cleared by software
  • 6. SCON (Serial Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 6  SM0 (SCON.7), SM1(SCON.6)  They determine the framing of data by specifying the number of bits per character, and the start and stop bits SM0 SM1 Serial Modes 0 0 Serial Mode 0 0 1 Serial Mode 1, 8 Bit data, 1 stop Bit, 1 start bit 1 0 Serial Mode 2 1 1 Serial Mode 3 Note: Only mode 1 is of our Interest
  • 7. Serial Modes Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 7  Serial Mode 1  Out of 4, only mode 1 is of our interest  Other 3 modes are rarely used  Asynchronous (single character at a time)  Data framing is of 8 bits, 1 stop bit, 1 start bit which makes it compatible with the COM port of IBM compatible PCs  Allows baud rate to be variable and is set by Timer 1 of 8051  For each character, a total of 10 bits are transferred where, First bit is start bit, followed by 8 data bits, and finally 1 stop bit
  • 8. Serial Modes Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 8  Serial Mode 0  Synchronous (Transfers block of character at a time)  Data transferred on RxD  Clock on TxD  Clock is fixed at oscillator frequency  Serial Mode 2  Asynchronous (single character at a time)  Data framing is of 11 bits, 1 stop bit, 1 start bit, 8 data bits (programmable 9 data bits)  On transmission TB8 bit of SCON is 9th Bit  9th Bit may be used for Data or Parity Bit  Baud rate may be 1/32 or 1/64 of oscillator frequency  Serial Mode 3  Same as Serial mode 2 with programmable baud rate
  • 9. SCON (Serial Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 9  SM2 (SCON.5)  This enables the multiprocessing capability of the 8051  For us, SM2 = 0 as 8051 will not be used in multiprocessor environment  REN (SCON.4)  receive enable  When REN = 1 (High), it allows 8051 to receive data on RxD pin  When REN = 0 (low), the receiver is disable  Can be used to block any serial data reception
  • 10. SCON (Serial Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 10  TB8 (SCON.3)  Transfer Bit  Used for Serial modes 2 and 3  For us, TB8 = 0 as we are using Serial Mode 1 for programming  RB8 (SCON.2)  receive Bit  Used for Serial modes 2 and 3  In Serial Mode 1, this bit gets the copy of stop Bit when an 8 bit data is received  For us, RB8 = 0
  • 11. SCON (Serial Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 11  TI (SCON.1)  transmit interrupt  When 8051 finishes the transfer of 8-bit character  It raises TI flag to indicate that it is ready to transfer another byte  TI bit is raised at the beginning of the stop bit  RI (SCON.0)  When 8051 receives data serially via RxD, it gets rid of the start and stop bits and places the byte in SBUF register  It raises the RI flag bit to indicate that a byte has been received and should be picked up before it is lost  RI is raised halfway through the stop bit
  • 12. Doubling Baud Rate in 8051 Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 12  There are two ways to increase the baud rate of data transfer  To use a higher frequency crystal  This is not feasible as System crystal is fixed  New Crystal Frequency may not be compatible with IBM PC serial COM’s port baud rate  To change a bit in the PCON register
  • 13. PCON (Power Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 13  It is an 8-bit register  Byte addressable  SMOD (Serial mode) bit  used serial communication  When 8051 is powered up, SMOD is zero  We can set it to high by software and the double the baud rate SMOD ---- ---- ---- GF1 GF0 PD IDL D7 D6 D5 D4 D3 D2 D1 D0
  • 14. PCON (Power Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 14  Following set of sequence can be used to set high D7 of PCON MOV A,PCON ;place a copy of PCON in ACC SETB ACC.7 ;make D7=1 MOV PCON,A ;now SMOD=1 without ;changing any other bits Note: PCON is byte addressable so cannot directly set bit D7 to high
  • 15. PCON (Power Control) Register Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 15  GF1 and GF0 Bits  Both are general purpose flag bits  PD (Power Down) Bit  Setting this bit activates Power down operation  Available only in CMOS  IDL (Idle mode) Bit  Setting this bit activates Idle mode operation  Available only in CMOS
  • 16. Doubling Baud Rate in 8051 Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 16  Considering, XTAL = 11.0592 MHz  For SMOD = 0  Machine cycle freq. = 11.0592 MHz / 12 = 921.6 kHz  Timer 1 frequency to set Baud Rate = 921.6 kHz / 32 = 28800 Hz  For SMOD = 1  Machine cycle freq. = 11.0592 MHz / 12 = 921.6 kHz  Timer 1 frequency to set Baud Rate = 921.6 kHz / 16 = 57,600 Hz
  • 17. Doubling Baud Rate in 8051 Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 17  Baud Rate Comparison for SMOD = 0 and SMOD = 1 TH1 (Decimal) TH1 (Hex) Baud Rate (SMOD = 0) Baud Rate (SMOD = 1) -3 FD 9600 19200 -6 FA 4800 9600 -12 F4 2400 4800 -24 E8 1200 2400
  • 18. Reference Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 18  “The 8051 Microcontroller and Embedded Systems using Assembly and C” , Muhammad Ali Mazidi, Janice Gillispie Mazidi, Rolin D. McKinlay, Second Edition, Pearson publication
  • 19. Prepared By: Ms. K. D. Patil, Dept. of Information Technology, Sanjivani COE, Kopargaon 19