SlideShare a Scribd company logo
Dr. Vikas Dongre
HOD Electronics
Government Polytechnic Washim
dongrevj1@gmail.com
High Resolution
Objectives
• Types of communication
• Baud rate setting
• Various SFRs used for serial communication
• Various modes of serial communication
• Programs for transmission and reception with
demonstration
UART
UART Universal Asynchronous Receiver Transmitter
Basics of serial communication
Parallel: expensive - short distance ( Within parts of a system) – fast
Serial :cheaper– long distance(Few Mtr. to many KM by modem)-slow
Basics of serial communication
Start and stop bits
When there is no transfer the signal is high Transmission
begins with a start (low) bit LSB first
Finally 1 stop bit (high) Data transfer rate (baud rate) is stated in
bps bps: bit per second
Framing ASCII “A” (41H)
Serial Port Block Diagram
In RS232, a 1 is represented
by -3 ~ -25 V, while a 0 bit is
+3 ~ +25 V, making -3 to +3
undefined
Micro
contol
ler 1
Max 232
Micro
contol
ler 2
Max 232
Tx
TxRx
Rx
How to communicate 8051 to PC
 Connect TXD to RXD and RXD to TXD from pc to 8051
 Use max232 to transform signal from TTL level to RS232 level
 The baud rate of the transmitting 8051 must matched the baud
rate of the receiving 8051 or pc
 PC standard baud rate
 2400-4800-9600-14400-19200-28800-33600-57600
 Timer 1 in mode 2 ( auto reload) is used for baud rate generation
 The 8051 UART divides the machine cycle frequency by 32
 Machine cycle is 1/12 XTAL frequency
TH1=FF+1- required Count
RxD and TxD pins in the 8051
• TxD pin 11 of the 8051 (P3.1)
• RxD pin 10 of the 8051 (P3.0)
SBUF register
MOV SBUF, #’D’ ;load SBUF=44H, ASCII for ‘D’
MOV SBUF, A ;copy accumulator into SBUF
MOV A, SBUF ;copy SBUF into accumulator
SFRs used
SBUF, SCON, PCON for actual communication
TCON,TMOD,TH1, TL1 for Baud Rate generation
Serial control (SCON) Register
Modes of operation
SM0 SM1 MODE operation transmit rate
0 0 0 shift register fixed (xtal/12)
0 1 1 8 bit UART variable (timer1)
1 0 2 9 bit UART fixed (xtal/32 or xtal/64)
1 1 3 9 bit UART variable (timer1)
Modes of operation
• 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 a 1/12 the oscillator frequency.
• Application
• Port expansion
8051
TXD
RXD Shift register
clk
data
Modes of operation
• Mode 1
• Ten 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 SCON
• the baud rate is determined by the Timer 1 overflow rate.
• Transmission is initiated by any instruction that uses SBUF as a
destination register.
Modes of operation
Power control register
 Bit 7 of PCON register
 If SMOD=1 double baud rate
 PCON is not bit addressable
 How to set SMOD
Mov a, pcon
Setb acc.7
Mov pcon,a
• Mode 2 :
• Eleven bits are transmitted (through TxD), received (through RxD)
• A start bit (0)
• 8 data bits (LSB first)
• A programmable 9th data bit
• and a stop bit (1)
• On transmit, the 9th bit (TB8) can be assigned 0 or 1.
• On receive, the 9th data bit goes into RB8 in SCON.
• the 9th can be parity bit
• The baud rate is programmable to 1/32 or 1/64 the oscillator frequency in
Mode 2 by SMOD bit in PCON register
• Mode 3
• Same as mode 2
• But may have a variable baud rate generated from Timer 1.
Modes of operation
Steps for Serial Transmission programming
1. Set communication mode using SCON SFR
2. Set Baud rate using TMOD , TH1 SFR
3. Start timer to generate baud rate
4. Move data in SBUF which you wish to transmit
5. Wait till the data byte is transmitted by monitoring the
setting of TI flag
6. Clear TI flag
7. Repeat step 4 to 6 again and again to transmit more
bytes
Note: Serial transmission and serial reception should run on both transmitting
and receiving controllers at the same time , that too with same baud rate
Serial Transmit(1)
ORG 0000
MOV TMOD ,#20H ; set timer 1 in mode 2
MOV TH1, #-3 ; set baud rate as 9600
MOV SCON, #50H ; set communication in mode 1 with receive enable
SETB TR1 ; start timer to generate baud rate
AGAIN:
MOV SBUF, #Y’ ;Transmit Y
back: JNB TI, back
CLR TI
MOV SBUF, #'E‘ ;Transmit E
JNB TI,$
CLR TI
MOV SBUF, #'S‘ ; Transmit S
JNB TI,$
CLR TI
MOV SBUF, #' ‘ : Transmit space
JNB TI,$
CLR TI
SJMP AGAIN
END
ORG 0000
MOV TMOD ,#20H
MOV TH1, #-3
MOV SCON, #50H
SETB TR1
AGAIN:
MOV SBUF, #"M"
CALL TRANSMIT
MOV SBUF, #'S'
CALL TRANSMIT
MOV SBUF, #'B'
CALL TRANSMIT
MOV SBUF, #'T'
CALL TRANSMIT
MOV SBUF, #'E'
CALL TRANSMIT
MOV SBUF, #' '
CALL TRANSMIT
SJMP AGAIN
TRANSMIT: JNB TI, $
CLR TI
RET
Serial Transmit(2)
ORG 0000
MOV TMOD ,#20H
MOV TH1, #-3
MOV SCON, #50H
SETB TR1
SETB TI
AGAIN: MOV R0,#10
MOV DPTR,#100H
BACK: MOV A,#00H
MOVC A, @A+DPTR
MOV SBUF,A
CALL TRANSMIT
INC DPTR
DJNZ R0, BACK
SJMP AGAIN
TRANSMIT: JNB TI,$
CLR TI
RET
ORG 100H
DB 'G','P',' ', 'W', 'A', 'S', 'H', 'I', 'M',' '
END
Serial Transmit(3)
Steps for Serial Reception programming
1. Set communication mode using SCON SFR
2. Set Baud rate using TMOD , TH1 SFR
3. Start timer to generate baud rate
4. Wait till the data byte is transmitted by monitoring the
setting of RI flag
5. Move data received in SBUF to other place like
memory or use on any port
6. Clear RI flag
7. Repeat step 4 to 6 again and again to transmit more
bytes
;PROGRAM FOR RECEIVING DATA SERIALY
ORG 0000
MOV TMOD ,#20H ;SET TIMER 1 IN MODE 2
MOV TH1, #-3 ; SET BAUD AS 9600
MOV SCON, #50H ; ENABLE RECRIVE
SETB TR1 ; START TIMER
BACK: JNB RI, $ ; CHECK IF BUFFER FULL
MOV A,SBUF ; IF YES READ THE SBUFFER
MOV P1,A ; SEND RECEIVED DATA TO PORT 1
CLR RI ; CLEAR RECEIVE FLAG
SJMP BACK
END
Serial Receive
Summery
• Concept of Serial and Parallel communication
• Asynchronous communication
• Concept of Start and Stop bits
• SCON, SMOD SFRs used for serial communication
• Various modes of serial communication
• Programs for transmission and reception with Keil Simulation
Thank you !!!
Dr. Vikas Dongre
HOD Electronics
Government Polytechnic Washim
dongrevj1@gmail.com

More Related Content

What's hot

Serial communication in LPC2148
Serial communication in LPC2148Serial communication in LPC2148
Serial communication in LPC2148
sravannunna24
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
Sudhanshu Janwadkar
 
Fun and Easy UART - How the UART Protocol Works
Fun and Easy UART - How the UART Protocol WorksFun and Easy UART - How the UART Protocol Works
Fun and Easy UART - How the UART Protocol Works
Ritesh Kanjee
 
Llpc2148 sci
Llpc2148 sciLlpc2148 sci
Llpc2148 scianishgoel
 
Imx53 uart- GUIDE BOOK
Imx53 uart- GUIDE BOOKImx53 uart- GUIDE BOOK
Imx53 uart- GUIDE BOOK
Shahrukh Javed
 
SPI Bus Protocol
SPI Bus ProtocolSPI Bus Protocol
SPI Bus Protocol
Sudhanshu Janwadkar
 
FPGA IMPLIMENTATION OF UART CONTTROLLER
FPGA IMPLIMENTATION OF UART CONTTROLLERFPGA IMPLIMENTATION OF UART CONTTROLLER
FPGA IMPLIMENTATION OF UART CONTTROLLER
Varun Kambrath
 
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterUniversal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Tejas Shetye
 
Design and implementation of uart on soc
Design and implementation of uart on socDesign and implementation of uart on soc
Design and implementation of uart on soc
Ijrdt Journal
 
Mridul_Verma_Intern_Tech_Adityaa_UART
Mridul_Verma_Intern_Tech_Adityaa_UARTMridul_Verma_Intern_Tech_Adityaa_UART
Mridul_Verma_Intern_Tech_Adityaa_UARTMridul Verma
 
Serial Communication Part-16
Serial Communication Part-16Serial Communication Part-16
Serial Communication Part-16
Techvilla
 
UART
UARTUART
Universal asynchronous receiver-transmitter UART Dsa project report
Universal asynchronous receiver-transmitter UART Dsa project reportUniversal asynchronous receiver-transmitter UART Dsa project report
Universal asynchronous receiver-transmitter UART Dsa project report
Shahrukh Javed
 
Verification of uart ip core using uvm
Verification of uart ip core using uvmVerification of uart ip core using uvm
Verification of uart ip core using uvm
eSAT Publishing House
 
Serial communication of microcontroller 8051
Serial communication of microcontroller 8051Serial communication of microcontroller 8051
Serial communication of microcontroller 8051
Nilesh Bhaskarrao Bahadure
 

What's hot (20)

UART
UARTUART
UART
 
Serial communication in LPC2148
Serial communication in LPC2148Serial communication in LPC2148
Serial communication in LPC2148
 
12 mt06ped019
12 mt06ped019 12 mt06ped019
12 mt06ped019
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
Fun and Easy UART - How the UART Protocol Works
Fun and Easy UART - How the UART Protocol WorksFun and Easy UART - How the UART Protocol Works
Fun and Easy UART - How the UART Protocol Works
 
Llpc2148 sci
Llpc2148 sciLlpc2148 sci
Llpc2148 sci
 
Imx53 uart- GUIDE BOOK
Imx53 uart- GUIDE BOOKImx53 uart- GUIDE BOOK
Imx53 uart- GUIDE BOOK
 
SPI Bus Protocol
SPI Bus ProtocolSPI Bus Protocol
SPI Bus Protocol
 
Uart
UartUart
Uart
 
NAVEEN UART BATCH 43
NAVEEN UART BATCH 43NAVEEN UART BATCH 43
NAVEEN UART BATCH 43
 
FPGA IMPLIMENTATION OF UART CONTTROLLER
FPGA IMPLIMENTATION OF UART CONTTROLLERFPGA IMPLIMENTATION OF UART CONTTROLLER
FPGA IMPLIMENTATION OF UART CONTTROLLER
 
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterUniversal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
 
Design and implementation of uart on soc
Design and implementation of uart on socDesign and implementation of uart on soc
Design and implementation of uart on soc
 
Mridul_Verma_Intern_Tech_Adityaa_UART
Mridul_Verma_Intern_Tech_Adityaa_UARTMridul_Verma_Intern_Tech_Adityaa_UART
Mridul_Verma_Intern_Tech_Adityaa_UART
 
Naveen UART BATCH 43
Naveen UART BATCH 43Naveen UART BATCH 43
Naveen UART BATCH 43
 
Serial Communication Part-16
Serial Communication Part-16Serial Communication Part-16
Serial Communication Part-16
 
UART
UARTUART
UART
 
Universal asynchronous receiver-transmitter UART Dsa project report
Universal asynchronous receiver-transmitter UART Dsa project reportUniversal asynchronous receiver-transmitter UART Dsa project report
Universal asynchronous receiver-transmitter UART Dsa project report
 
Verification of uart ip core using uvm
Verification of uart ip core using uvmVerification of uart ip core using uvm
Verification of uart ip core using uvm
 
Serial communication of microcontroller 8051
Serial communication of microcontroller 8051Serial communication of microcontroller 8051
Serial communication of microcontroller 8051
 

Similar to Serial communication

Sereial com. ppt
Sereial com. pptSereial com. ppt
Sereial com. pptgaurav5345
 
EC8691 - UNIT 5.pdf
EC8691 - UNIT 5.pdfEC8691 - UNIT 5.pdf
EC8691 - UNIT 5.pdf
SPonmalar1
 
Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....
ANKUSH445845
 
Serial.ppt and it contains all information
Serial.ppt and it contains all informationSerial.ppt and it contains all information
Serial.ppt and it contains all information
shwetasonkar638
 
8051 SERIAL PORTS.pptx
8051 SERIAL PORTS.pptx8051 SERIAL PORTS.pptx
8051 SERIAL PORTS.pptx
maheswariM7
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051
logesh waran
 
Serial data transfer
Serial data transferSerial data transfer
Serial data transfer
Dinesh Subhuraaj
 
8051 serial communication1
8051 serial communication1 8051 serial communication1
8051 serial communication1 vijaydeepakg
 
8051 microcontroller notes continuous
8051 microcontroller notes continuous 8051 microcontroller notes continuous
8051 microcontroller notes continuous
THANDAIAH PRABU
 
Library Book Locator
Library Book LocatorLibrary Book Locator
Library Book Locator
Arun Joseph
 
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
ShashiKiran664181
 
Class10
Class10Class10
8051 serial communication
8051 serial communication8051 serial communication
8051 serial communicationcanh phan
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
sinaankhalil
 
Modem synchronization and control
Modem synchronization and controlModem synchronization and control
Modem synchronization and control
sirish2chandraa
 
DATA TRANSFER SCHEMES OF 8085
DATA TRANSFER SCHEMES OF 8085DATA TRANSFER SCHEMES OF 8085
DATA TRANSFER SCHEMES OF 8085
saravanamanikandan02
 
Analog Transmission
Analog TransmissionAnalog Transmission
Analog Transmission
Shiraz316
 
Lecture 2 encoding
Lecture 2 encoding Lecture 2 encoding
Lecture 2 encoding
Josh Street
 
Lecture 2 encoding
Lecture 2 encodingLecture 2 encoding
Lecture 2 encoding
Josh Street
 

Similar to Serial communication (20)

Sereial com. ppt
Sereial com. pptSereial com. ppt
Sereial com. ppt
 
EC8691 - UNIT 5.pdf
EC8691 - UNIT 5.pdfEC8691 - UNIT 5.pdf
EC8691 - UNIT 5.pdf
 
Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....
 
Serial.ppt and it contains all information
Serial.ppt and it contains all informationSerial.ppt and it contains all information
Serial.ppt and it contains all information
 
8051 SERIAL PORTS.pptx
8051 SERIAL PORTS.pptx8051 SERIAL PORTS.pptx
8051 SERIAL PORTS.pptx
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051
 
Serial data transfer
Serial data transferSerial data transfer
Serial data transfer
 
8051 serial communication1
8051 serial communication1 8051 serial communication1
8051 serial communication1
 
8051 microcontroller notes continuous
8051 microcontroller notes continuous 8051 microcontroller notes continuous
8051 microcontroller notes continuous
 
Library Book Locator
Library Book LocatorLibrary Book Locator
Library Book Locator
 
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
 
7 serial port
7 serial port7 serial port
7 serial port
 
Class10
Class10Class10
Class10
 
8051 serial communication
8051 serial communication8051 serial communication
8051 serial communication
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
 
Modem synchronization and control
Modem synchronization and controlModem synchronization and control
Modem synchronization and control
 
DATA TRANSFER SCHEMES OF 8085
DATA TRANSFER SCHEMES OF 8085DATA TRANSFER SCHEMES OF 8085
DATA TRANSFER SCHEMES OF 8085
 
Analog Transmission
Analog TransmissionAnalog Transmission
Analog Transmission
 
Lecture 2 encoding
Lecture 2 encoding Lecture 2 encoding
Lecture 2 encoding
 
Lecture 2 encoding
Lecture 2 encodingLecture 2 encoding
Lecture 2 encoding
 

More from Vikas Dongre

Lcd interfaing using 8051 and assambly language programming
Lcd interfaing using 8051 and assambly language programmingLcd interfaing using 8051 and assambly language programming
Lcd interfaing using 8051 and assambly language programming
Vikas Dongre
 
Job opportunities for electronics engineering
Job opportunities for electronics engineeringJob opportunities for electronics engineering
Job opportunities for electronics engineering
Vikas Dongre
 
Educational video creation: Tools and tips
Educational video creation: Tools and tipsEducational video creation: Tools and tips
Educational video creation: Tools and tips
Vikas Dongre
 
Scope of job education and business after HSC
Scope of job  education and business after HSCScope of job  education and business after HSC
Scope of job education and business after HSC
Vikas Dongre
 
Introduction to digital logic gates
Introduction to digital logic gatesIntroduction to digital logic gates
Introduction to digital logic gates
Vikas Dongre
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number system
Vikas Dongre
 
Timer programming for 8051 using embedded c
Timer programming for 8051 using embedded cTimer programming for 8051 using embedded c
Timer programming for 8051 using embedded c
Vikas Dongre
 
Arithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CArithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded C
Vikas Dongre
 
Introduction to Embedded system programming using 8051
Introduction to Embedded system programming using 8051Introduction to Embedded system programming using 8051
Introduction to Embedded system programming using 8051
Vikas Dongre
 
Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051
Vikas Dongre
 
Arithmetic and logic operations in c
Arithmetic and logic operations in cArithmetic and logic operations in c
Arithmetic and logic operations in c
Vikas Dongre
 
Arithmetic and logic operations in c
Arithmetic and logic operations in cArithmetic and logic operations in c
Arithmetic and logic operations in c
Vikas Dongre
 
Classification of embedded systems
Classification of embedded systemsClassification of embedded systems
Classification of embedded systems
Vikas Dongre
 
Characteristics of embedded systems
Characteristics of embedded systemsCharacteristics of embedded systems
Characteristics of embedded systems
Vikas Dongre
 
Features of 89c51,pic,avr & arm processors
Features of 89c51,pic,avr & arm processorsFeatures of 89c51,pic,avr & arm processors
Features of 89c51,pic,avr & arm processors
Vikas Dongre
 
Microcontroller architecture
Microcontroller architectureMicrocontroller architecture
Microcontroller architecture
Vikas Dongre
 
2. block diagram and components of embedded system
2. block diagram and components of embedded system2. block diagram and components of embedded system
2. block diagram and components of embedded system
Vikas Dongre
 
1. advantages and applications of embedded system
1. advantages and applications of embedded system1. advantages and applications of embedded system
1. advantages and applications of embedded system
Vikas Dongre
 
Innovative improvements in electronic engineering laboratory education using eml
Innovative improvements in electronic engineering laboratory education using emlInnovative improvements in electronic engineering laboratory education using eml
Innovative improvements in electronic engineering laboratory education using eml
Vikas Dongre
 
Devnagari handwritten numeral recognition using geometric features and statis...
Devnagari handwritten numeral recognition using geometric features and statis...Devnagari handwritten numeral recognition using geometric features and statis...
Devnagari handwritten numeral recognition using geometric features and statis...
Vikas Dongre
 

More from Vikas Dongre (20)

Lcd interfaing using 8051 and assambly language programming
Lcd interfaing using 8051 and assambly language programmingLcd interfaing using 8051 and assambly language programming
Lcd interfaing using 8051 and assambly language programming
 
Job opportunities for electronics engineering
Job opportunities for electronics engineeringJob opportunities for electronics engineering
Job opportunities for electronics engineering
 
Educational video creation: Tools and tips
Educational video creation: Tools and tipsEducational video creation: Tools and tips
Educational video creation: Tools and tips
 
Scope of job education and business after HSC
Scope of job  education and business after HSCScope of job  education and business after HSC
Scope of job education and business after HSC
 
Introduction to digital logic gates
Introduction to digital logic gatesIntroduction to digital logic gates
Introduction to digital logic gates
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number system
 
Timer programming for 8051 using embedded c
Timer programming for 8051 using embedded cTimer programming for 8051 using embedded c
Timer programming for 8051 using embedded c
 
Arithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CArithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded C
 
Introduction to Embedded system programming using 8051
Introduction to Embedded system programming using 8051Introduction to Embedded system programming using 8051
Introduction to Embedded system programming using 8051
 
Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051
 
Arithmetic and logic operations in c
Arithmetic and logic operations in cArithmetic and logic operations in c
Arithmetic and logic operations in c
 
Arithmetic and logic operations in c
Arithmetic and logic operations in cArithmetic and logic operations in c
Arithmetic and logic operations in c
 
Classification of embedded systems
Classification of embedded systemsClassification of embedded systems
Classification of embedded systems
 
Characteristics of embedded systems
Characteristics of embedded systemsCharacteristics of embedded systems
Characteristics of embedded systems
 
Features of 89c51,pic,avr & arm processors
Features of 89c51,pic,avr & arm processorsFeatures of 89c51,pic,avr & arm processors
Features of 89c51,pic,avr & arm processors
 
Microcontroller architecture
Microcontroller architectureMicrocontroller architecture
Microcontroller architecture
 
2. block diagram and components of embedded system
2. block diagram and components of embedded system2. block diagram and components of embedded system
2. block diagram and components of embedded system
 
1. advantages and applications of embedded system
1. advantages and applications of embedded system1. advantages and applications of embedded system
1. advantages and applications of embedded system
 
Innovative improvements in electronic engineering laboratory education using eml
Innovative improvements in electronic engineering laboratory education using emlInnovative improvements in electronic engineering laboratory education using eml
Innovative improvements in electronic engineering laboratory education using eml
 
Devnagari handwritten numeral recognition using geometric features and statis...
Devnagari handwritten numeral recognition using geometric features and statis...Devnagari handwritten numeral recognition using geometric features and statis...
Devnagari handwritten numeral recognition using geometric features and statis...
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 

Serial communication

  • 1. Dr. Vikas Dongre HOD Electronics Government Polytechnic Washim dongrevj1@gmail.com High Resolution
  • 2. Objectives • Types of communication • Baud rate setting • Various SFRs used for serial communication • Various modes of serial communication • Programs for transmission and reception with demonstration
  • 3. UART UART Universal Asynchronous Receiver Transmitter
  • 4. Basics of serial communication Parallel: expensive - short distance ( Within parts of a system) – fast Serial :cheaper– long distance(Few Mtr. to many KM by modem)-slow
  • 5. Basics of serial communication
  • 6. Start and stop bits When there is no transfer the signal is high Transmission begins with a start (low) bit LSB first Finally 1 stop bit (high) Data transfer rate (baud rate) is stated in bps bps: bit per second Framing ASCII “A” (41H)
  • 8. In RS232, a 1 is represented by -3 ~ -25 V, while a 0 bit is +3 ~ +25 V, making -3 to +3 undefined
  • 10. How to communicate 8051 to PC  Connect TXD to RXD and RXD to TXD from pc to 8051  Use max232 to transform signal from TTL level to RS232 level  The baud rate of the transmitting 8051 must matched the baud rate of the receiving 8051 or pc  PC standard baud rate  2400-4800-9600-14400-19200-28800-33600-57600  Timer 1 in mode 2 ( auto reload) is used for baud rate generation  The 8051 UART divides the machine cycle frequency by 32  Machine cycle is 1/12 XTAL frequency
  • 12. RxD and TxD pins in the 8051 • TxD pin 11 of the 8051 (P3.1) • RxD pin 10 of the 8051 (P3.0) SBUF register MOV SBUF, #’D’ ;load SBUF=44H, ASCII for ‘D’ MOV SBUF, A ;copy accumulator into SBUF MOV A, SBUF ;copy SBUF into accumulator SFRs used SBUF, SCON, PCON for actual communication TCON,TMOD,TH1, TL1 for Baud Rate generation
  • 14. Modes of operation SM0 SM1 MODE operation transmit rate 0 0 0 shift register fixed (xtal/12) 0 1 1 8 bit UART variable (timer1) 1 0 2 9 bit UART fixed (xtal/32 or xtal/64) 1 1 3 9 bit UART variable (timer1)
  • 15. Modes of operation • 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 a 1/12 the oscillator frequency. • Application • Port expansion 8051 TXD RXD Shift register clk data
  • 16. Modes of operation • Mode 1 • Ten 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 SCON • the baud rate is determined by the Timer 1 overflow rate. • Transmission is initiated by any instruction that uses SBUF as a destination register.
  • 18. Power control register  Bit 7 of PCON register  If SMOD=1 double baud rate  PCON is not bit addressable  How to set SMOD Mov a, pcon Setb acc.7 Mov pcon,a
  • 19. • Mode 2 : • Eleven bits are transmitted (through TxD), received (through RxD) • A start bit (0) • 8 data bits (LSB first) • A programmable 9th data bit • and a stop bit (1) • On transmit, the 9th bit (TB8) can be assigned 0 or 1. • On receive, the 9th data bit goes into RB8 in SCON. • the 9th can be parity bit • The baud rate is programmable to 1/32 or 1/64 the oscillator frequency in Mode 2 by SMOD bit in PCON register • Mode 3 • Same as mode 2 • But may have a variable baud rate generated from Timer 1. Modes of operation
  • 20. Steps for Serial Transmission programming 1. Set communication mode using SCON SFR 2. Set Baud rate using TMOD , TH1 SFR 3. Start timer to generate baud rate 4. Move data in SBUF which you wish to transmit 5. Wait till the data byte is transmitted by monitoring the setting of TI flag 6. Clear TI flag 7. Repeat step 4 to 6 again and again to transmit more bytes Note: Serial transmission and serial reception should run on both transmitting and receiving controllers at the same time , that too with same baud rate
  • 21. Serial Transmit(1) ORG 0000 MOV TMOD ,#20H ; set timer 1 in mode 2 MOV TH1, #-3 ; set baud rate as 9600 MOV SCON, #50H ; set communication in mode 1 with receive enable SETB TR1 ; start timer to generate baud rate AGAIN: MOV SBUF, #Y’ ;Transmit Y back: JNB TI, back CLR TI MOV SBUF, #'E‘ ;Transmit E JNB TI,$ CLR TI MOV SBUF, #'S‘ ; Transmit S JNB TI,$ CLR TI MOV SBUF, #' ‘ : Transmit space JNB TI,$ CLR TI SJMP AGAIN END
  • 22.
  • 23. ORG 0000 MOV TMOD ,#20H MOV TH1, #-3 MOV SCON, #50H SETB TR1 AGAIN: MOV SBUF, #"M" CALL TRANSMIT MOV SBUF, #'S' CALL TRANSMIT MOV SBUF, #'B' CALL TRANSMIT MOV SBUF, #'T' CALL TRANSMIT MOV SBUF, #'E' CALL TRANSMIT MOV SBUF, #' ' CALL TRANSMIT SJMP AGAIN TRANSMIT: JNB TI, $ CLR TI RET Serial Transmit(2)
  • 24. ORG 0000 MOV TMOD ,#20H MOV TH1, #-3 MOV SCON, #50H SETB TR1 SETB TI AGAIN: MOV R0,#10 MOV DPTR,#100H BACK: MOV A,#00H MOVC A, @A+DPTR MOV SBUF,A CALL TRANSMIT INC DPTR DJNZ R0, BACK SJMP AGAIN TRANSMIT: JNB TI,$ CLR TI RET ORG 100H DB 'G','P',' ', 'W', 'A', 'S', 'H', 'I', 'M',' ' END Serial Transmit(3)
  • 25. Steps for Serial Reception programming 1. Set communication mode using SCON SFR 2. Set Baud rate using TMOD , TH1 SFR 3. Start timer to generate baud rate 4. Wait till the data byte is transmitted by monitoring the setting of RI flag 5. Move data received in SBUF to other place like memory or use on any port 6. Clear RI flag 7. Repeat step 4 to 6 again and again to transmit more bytes
  • 26. ;PROGRAM FOR RECEIVING DATA SERIALY ORG 0000 MOV TMOD ,#20H ;SET TIMER 1 IN MODE 2 MOV TH1, #-3 ; SET BAUD AS 9600 MOV SCON, #50H ; ENABLE RECRIVE SETB TR1 ; START TIMER BACK: JNB RI, $ ; CHECK IF BUFFER FULL MOV A,SBUF ; IF YES READ THE SBUFFER MOV P1,A ; SEND RECEIVED DATA TO PORT 1 CLR RI ; CLEAR RECEIVE FLAG SJMP BACK END Serial Receive
  • 27. Summery • Concept of Serial and Parallel communication • Asynchronous communication • Concept of Start and Stop bits • SCON, SMOD SFRs used for serial communication • Various modes of serial communication • Programs for transmission and reception with Keil Simulation
  • 28. Thank you !!! Dr. Vikas Dongre HOD Electronics Government Polytechnic Washim dongrevj1@gmail.com