SlideShare a Scribd company logo
1 of 19
Download to read offline
Serial Communication in Atmega328P
(Lecture-16)
R S Ananda Murthy
Associate Professor
Department of Electrical & Electronics Engineering,
Sri Jayachamarajendra College of Engineering,
Mysore 570 006
R S Ananda Murthy Serial Communication in Atmega328P
Serial and Parallel Communication
Sender Receiver
Sender Receiver
D0
D7
:
:
:
:
:
D0D1..D7
Serial Communication
Parallel Communication
R S Ananda Murthy Serial Communication in Atmega328P
Serial versus Parallel Communication
Serial Communication
Bit-by-bit transmission.
Requires parallel-to-serial conversion at the sending end
and serial-to-parallel conversion at the receiving end.
Requires lesser number of wires as compared to parallel
communication.
Serial high-speed communication is becoming possible
now-a-days with improved hardware.
RS232, RS485, SPI, USB, I2C and CAN – all these
methods of communication employ serial communication.
Parallel Communication
Byte-by-byte transmission on eight data lines.
Was popular in 1990s because of its then higher speed as
compared serial communication.
Not suitable for long distance communication as number of
wires required is more.
R S Ananda Murthy Serial Communication in Atmega328P
Types of Serial Communication
Synchronous
Sender and receiver are driven by the same clock signal.
SPI and I2C communication protocols are very common
examples of synchronous serial communication.
Transfers a block of data (several characters) in one
operation.
Asynchronous
Sender and receiver are not driven by the same clock
signal.
Sender and receiver have to agree to operate at the same
baud rate.
Synchronization of sender and receiver is achieved by
inserting START and STOP bits along with the data bits to
form a data frame.
Typically used to transmit a single character at a time.
R S Ananda Murthy Serial Communication in Atmega328P
Technical Terms Related to Serial Communication
Baud Rate Bits per second.
Simplex One-way communication. For example, Device-1
can send data to Device-2 and not vice versa.
Full-duplex Two-way communication. Device-1 and 2 can both
send and receive data simultaneously.
Half-duplex Two-way communication, but not simultaneously.
USART Universal Synchronous Asynchronous Receiver
Transmitter. In most of the modern MCUs like
Atmega328P this block is integrated on the chip.
Data Frame Data bits along with START bit, STOP bit, and
optional parity bit is called a data frame.
Modem A device which converts 1s and 0s to audio tones
used for serial communication on telephone lines.
R S Ananda Murthy Serial Communication in Atmega328P
Data Frame
0 1 0 0 0 0 0Stop Start1
D0D1D2D3D4D5D6D7
Mark
Direction of transmission
Framing of ASCII Charater `A' (0x41) for serial communication
When there is no data transfer, the status of signal is 1
(high) which is also referred to as Mark.
Transmission begins with a Start bit which is 0 (low), also
called as Space.
After this the data bits are transmitted in the order LSB to
MSB and a STOP bit which is high (1).
In some systems, a parity bit for even or odd parity is
included in the data frame for data integrity.
R S Ananda Murthy Serial Communication in Atmega328P
RS232C Standard for Serial Communication
Proposed by Electronics Industries Association in 1960s.
Widely used for short distance serial communication even
today.
As per this standard, a voltage in the range −3 V to −25 V
represents a logical high (1) and a voltage level in the
range +3 V to +25 V represents a logical low (0).
Since the voltage levels of this standard are not compatible
with TTL levels used by MCUs such as Atmega328P, we
need to use a voltage converter chip such as MAX232 or
MAX233.
R S Ananda Murthy Serial Communication in Atmega328P
MAX232 Converter Chip
R S Ananda Murthy Serial Communication in Atmega328P
PC Serial Port Communication with MAX232
R S Ananda Murthy Serial Communication in Atmega328P
Block Diagram of USART0 in Atmega328P
R S Ananda Murthy Serial Communication in Atmega328P
USART0 Pins of Atmega328P
TxD On this pin serial data is transmitted by the
USART0
RxD On this pin serial data is received by the USART0
XCK This pin is used for clock signal only during
synchronous serial communication.
R S Ananda Murthy Serial Communication in Atmega328P
Serial Peripheral Interface (SPI)
SPI
Master
SPI
Slave
SDO
MOSI
SDI
SDI SDO
SCLK SCLK
SCK
CE CE
SS
MISO
MOSI – Master Out Slave In; MISO – Master In Slave Out;
SCK – Serial Clock; SS – Slave Select
SPI interface is typically used for short distance
communication between two devices.
R S Ananda Murthy Serial Communication in Atmega328P
Serial Peripheral Interface (SPI)
SPI, originally proposed by Motorola (now Freescale), uses
four wires – SDI (also called MOSI), SDO (also called
MISO), SCLK (also called SCK) , and CE (also called SS).
In SPI, one device will be master and the other device/s
will be slave/s.
Master always starts the communication by activating SS
and SCK.
SPI Communication is full-duplex.
In some systems SPI uses a common wire for both
MOSI/MISO, thus reducing the number of wires to three.
But such systems follow a different protocol for data
transmission as compared to 4-wire SPI systems.
R S Ananda Murthy Serial Communication in Atmega328P
SPI Architecture
When master wants to send a byte it places it in its shift
register and issues 8 clock pulses.
Then, the contents of the shift registers in the master and
slave are interchanged.
Clock input to the shift registers can be falling- or
rising-edge triggered.
R S Ananda Murthy Serial Communication in Atmega328P
SPI Modes of Operation
Write Operation (indicated by D7 = 1 of the first byte)
Single-byte – write a byte to the slave.
Multi-byte – write multiple bytes to the slave.
Read Operation (indicated by D7 = 0 of the first byte)
Single-byte – read a byte from the slave.
Multi-byte – read multiple bytes from the slave
Multi-byte operations are also known as burst mode operations.
R S Ananda Murthy Serial Communication in Atmega328P
Single-byte SPI Write Operation
1 Master places the bit pattern 1A6A5A4A3A2A1A0 in its shift
register, makes SS = 0 to select the slave, and then issues
8 pulses of SCK to transfer it to the slave on the MOSI line.
2 Master issues 8 more pulses of SCK to shift a byte of data
to the slave on the MOSI line and then makes SS = 1 to
deselect the slave.
R S Ananda Murthy Serial Communication in Atmega328P
Single-byte SPI Read Operation
1 Master places the bit pattern 0A6A5A4A3A2A1A0 in its shift
register, makes SS = 0 to select the slave, and then issues
8 pulses of SCK to transfer it to the slave on the MOSI line.
2 Master issues 8 more pulses of SCK to shift a byte of data
from the slave on the MISO line and then makes SS = 1 to
deselect the slave.
R S Ananda Murthy Serial Communication in Atmega328P
SPI Burst Mode Operations
SPI Burst Mode Write Operation
SPI Burst Mode Read Operation.
In this mode, the address is automatically updated in the slave
and the byte count is maintained in the master.
R S Ananda Murthy Serial Communication in Atmega328P
License
This work is licensed under a
Creative Commons Attribution 4.0 International License.
R S Ananda Murthy Serial Communication in Atmega328P

More Related Content

What's hot

L11 assembly-language-programming-of-atmega328 p
L11 assembly-language-programming-of-atmega328 pL11 assembly-language-programming-of-atmega328 p
L11 assembly-language-programming-of-atmega328 prsamurti
 
Microprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answersMicroprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answersAbhijith Augustine
 
L12 c-language-programming-of-atmega328 p
L12 c-language-programming-of-atmega328 pL12 c-language-programming-of-atmega328 p
L12 c-language-programming-of-atmega328 prsamurti
 
Lect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTURELect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTUREDr.YNM
 
The 8051 Microcontroller and Embedded Systems
The 8051 Microcontroller and Embedded SystemsThe 8051 Microcontroller and Embedded Systems
The 8051 Microcontroller and Embedded SystemsAvijeet Negel
 
Arm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speedArm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speedUday Wankar
 
M.sc I-sem-8086 notes
M.sc  I-sem-8086 notesM.sc  I-sem-8086 notes
M.sc I-sem-8086 notesDr.YNM
 
how to generate sms
how to generate smshow to generate sms
how to generate smssumant reddy
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESDr.YNM
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollersmike parks
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessormaruthisai
 
Unit II Study of Onchip Peripherals
Unit II Study of Onchip PeripheralsUnit II Study of Onchip Peripherals
Unit II Study of Onchip PeripheralsDr. Pankaj Zope
 
Chapter 4 - Interrupts of 8085
Chapter 4 - Interrupts of 8085Chapter 4 - Interrupts of 8085
Chapter 4 - Interrupts of 8085Bisrat Girma
 
Solution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsSolution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsmanishpatel_79
 

What's hot (18)

L11 assembly-language-programming-of-atmega328 p
L11 assembly-language-programming-of-atmega328 pL11 assembly-language-programming-of-atmega328 p
L11 assembly-language-programming-of-atmega328 p
 
Microprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answersMicroprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answers
 
L12 c-language-programming-of-atmega328 p
L12 c-language-programming-of-atmega328 pL12 c-language-programming-of-atmega328 p
L12 c-language-programming-of-atmega328 p
 
viva q&a for mp lab
viva q&a for mp labviva q&a for mp lab
viva q&a for mp lab
 
Lect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTURELect 4 ARM PROCESSOR ARCHITECTURE
Lect 4 ARM PROCESSOR ARCHITECTURE
 
The 8051 Microcontroller and Embedded Systems
The 8051 Microcontroller and Embedded SystemsThe 8051 Microcontroller and Embedded Systems
The 8051 Microcontroller and Embedded Systems
 
Arm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speedArm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speed
 
M.sc I-sem-8086 notes
M.sc  I-sem-8086 notesM.sc  I-sem-8086 notes
M.sc I-sem-8086 notes
 
Basic 8051 question
Basic 8051 questionBasic 8051 question
Basic 8051 question
 
how to generate sms
how to generate smshow to generate sms
how to generate sms
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
Important questions
Important questionsImportant questions
Important questions
 
Important questions
Important questionsImportant questions
Important questions
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 
Unit II Study of Onchip Peripherals
Unit II Study of Onchip PeripheralsUnit II Study of Onchip Peripherals
Unit II Study of Onchip Peripherals
 
Chapter 4 - Interrupts of 8085
Chapter 4 - Interrupts of 8085Chapter 4 - Interrupts of 8085
Chapter 4 - Interrupts of 8085
 
Solution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsSolution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systems
 

Viewers also liked

Arduino atmega328
Arduino atmega328Arduino atmega328
Arduino atmega328Luciano FS
 
L7 starting-to-use-mcu
L7 starting-to-use-mcuL7 starting-to-use-mcu
L7 starting-to-use-mcursamurti
 
L3 instruction-execution-steps
L3 instruction-execution-stepsL3 instruction-execution-steps
L3 instruction-execution-stepsrsamurti
 
Introduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeXIntroduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeXrsamurti
 
Lecture-1 : Introduction to Power Electronics
Lecture-1 : Introduction to Power ElectronicsLecture-1 : Introduction to Power Electronics
Lecture-1 : Introduction to Power Electronicsrsamurti
 
Trends in-power-electronics
Trends in-power-electronicsTrends in-power-electronics
Trends in-power-electronicsrsamurti
 
L5 data-parallel-computers
L5 data-parallel-computersL5 data-parallel-computers
L5 data-parallel-computersrsamurti
 
L6 primary-memory
L6 primary-memoryL6 primary-memory
L6 primary-memoryrsamurti
 
Transformers
TransformersTransformers
Transformersrsamurti
 
L4 speeding-up-execution
L4 speeding-up-executionL4 speeding-up-execution
L4 speeding-up-executionrsamurti
 
Lecture-5 : Semiconductor Power Switching Devices-2
Lecture-5 : Semiconductor Power Switching Devices-2Lecture-5 : Semiconductor Power Switching Devices-2
Lecture-5 : Semiconductor Power Switching Devices-2rsamurti
 
Lecture-3 : More Applications of Power Electronics
Lecture-3 : More Applications of Power ElectronicsLecture-3 : More Applications of Power Electronics
Lecture-3 : More Applications of Power Electronicsrsamurti
 
Lecture-7 : Semiconductor Power Switching Devices-4
Lecture-7 : Semiconductor Power Switching Devices-4Lecture-7 : Semiconductor Power Switching Devices-4
Lecture-7 : Semiconductor Power Switching Devices-4rsamurti
 
Lecture-2 : Applications of Power Electronics
Lecture-2 : Applications of Power ElectronicsLecture-2 : Applications of Power Electronics
Lecture-2 : Applications of Power Electronicsrsamurti
 
Three phase-circuits
Three phase-circuitsThree phase-circuits
Three phase-circuitsrsamurti
 
Synchronous generators
Synchronous generatorsSynchronous generators
Synchronous generatorsrsamurti
 
Lecture-4 : Semiconductor Power Switching Devices-1
Lecture-4 : Semiconductor Power Switching Devices-1Lecture-4 : Semiconductor Power Switching Devices-1
Lecture-4 : Semiconductor Power Switching Devices-1rsamurti
 

Viewers also liked (18)

Arduino atmega328
Arduino atmega328Arduino atmega328
Arduino atmega328
 
L7 starting-to-use-mcu
L7 starting-to-use-mcuL7 starting-to-use-mcu
L7 starting-to-use-mcu
 
L3 instruction-execution-steps
L3 instruction-execution-stepsL3 instruction-execution-steps
L3 instruction-execution-steps
 
Introduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeXIntroduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeX
 
Lecture-1 : Introduction to Power Electronics
Lecture-1 : Introduction to Power ElectronicsLecture-1 : Introduction to Power Electronics
Lecture-1 : Introduction to Power Electronics
 
Trends in-power-electronics
Trends in-power-electronicsTrends in-power-electronics
Trends in-power-electronics
 
L5 data-parallel-computers
L5 data-parallel-computersL5 data-parallel-computers
L5 data-parallel-computers
 
L6 primary-memory
L6 primary-memoryL6 primary-memory
L6 primary-memory
 
Transformers
TransformersTransformers
Transformers
 
L4 speeding-up-execution
L4 speeding-up-executionL4 speeding-up-execution
L4 speeding-up-execution
 
Lecture-5 : Semiconductor Power Switching Devices-2
Lecture-5 : Semiconductor Power Switching Devices-2Lecture-5 : Semiconductor Power Switching Devices-2
Lecture-5 : Semiconductor Power Switching Devices-2
 
Lecture-3 : More Applications of Power Electronics
Lecture-3 : More Applications of Power ElectronicsLecture-3 : More Applications of Power Electronics
Lecture-3 : More Applications of Power Electronics
 
Lecture-7 : Semiconductor Power Switching Devices-4
Lecture-7 : Semiconductor Power Switching Devices-4Lecture-7 : Semiconductor Power Switching Devices-4
Lecture-7 : Semiconductor Power Switching Devices-4
 
Lecture-2 : Applications of Power Electronics
Lecture-2 : Applications of Power ElectronicsLecture-2 : Applications of Power Electronics
Lecture-2 : Applications of Power Electronics
 
Three phase-circuits
Three phase-circuitsThree phase-circuits
Three phase-circuits
 
Synchronous generators
Synchronous generatorsSynchronous generators
Synchronous generators
 
Lecture-4 : Semiconductor Power Switching Devices-1
Lecture-4 : Semiconductor Power Switching Devices-1Lecture-4 : Semiconductor Power Switching Devices-1
Lecture-4 : Semiconductor Power Switching Devices-1
 
Avr instruction set
Avr instruction setAvr instruction set
Avr instruction set
 

Similar to L16 usart-atmega328 p

UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptxnaveen088888
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral InterfaceChirag Parikh
 
serial-200505101453.pdf
serial-200505101453.pdfserial-200505101453.pdf
serial-200505101453.pdfKiranG731731
 
Serial Communication
Serial CommunicationSerial Communication
Serial CommunicationUshaRani289
 
B sc e5.2 mp unit 3 interfacing
B sc e5.2 mp unit 3 interfacingB sc e5.2 mp unit 3 interfacing
B sc e5.2 mp unit 3 interfacingMahiboobAliMulla
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemsRaghunath reddy
 
Embedded & pcb design
Embedded & pcb designEmbedded & pcb design
Embedded & pcb designTanveer Behl
 
Rf module interfacing without microcontrollers
Rf module interfacing without microcontrollersRf module interfacing without microcontrollers
Rf module interfacing without microcontrollersTauseef khan
 
Please in your own words describe SPI, I2C, and UART with the follow.pdf
Please in your own words describe SPI, I2C, and UART with the follow.pdfPlease in your own words describe SPI, I2C, and UART with the follow.pdf
Please in your own words describe SPI, I2C, and UART with the follow.pdfflashfashioncasualwe
 
underground cable fault location using aruino,gsm&gps
underground cable fault location using aruino,gsm&gps underground cable fault location using aruino,gsm&gps
underground cable fault location using aruino,gsm&gps Mohd Sohail
 
Microprocessor-Architecture [8085]
Microprocessor-Architecture [8085]Microprocessor-Architecture [8085]
Microprocessor-Architecture [8085]GIARINDIA
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentFastBit Embedded Brain Academy
 

Similar to L16 usart-atmega328 p (20)

microprocessor 8085
microprocessor 8085microprocessor 8085
microprocessor 8085
 
I2C PRESENTATION.PPT
I2C PRESENTATION.PPTI2C PRESENTATION.PPT
I2C PRESENTATION.PPT
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptx
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systems
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
 
serial-200505101453.pdf
serial-200505101453.pdfserial-200505101453.pdf
serial-200505101453.pdf
 
Serial Communication
Serial CommunicationSerial Communication
Serial Communication
 
B sc e5.2 mp unit 3 interfacing
B sc e5.2 mp unit 3 interfacingB sc e5.2 mp unit 3 interfacing
B sc e5.2 mp unit 3 interfacing
 
Ofdm.pptx
Ofdm.pptxOfdm.pptx
Ofdm.pptx
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
 
Embedded & pcb design
Embedded & pcb designEmbedded & pcb design
Embedded & pcb design
 
Ju2416921695
Ju2416921695Ju2416921695
Ju2416921695
 
Rf module interfacing without microcontrollers
Rf module interfacing without microcontrollersRf module interfacing without microcontrollers
Rf module interfacing without microcontrollers
 
Please in your own words describe SPI, I2C, and UART with the follow.pdf
Please in your own words describe SPI, I2C, and UART with the follow.pdfPlease in your own words describe SPI, I2C, and UART with the follow.pdf
Please in your own words describe SPI, I2C, and UART with the follow.pdf
 
underground cable fault location using aruino,gsm&gps
underground cable fault location using aruino,gsm&gps underground cable fault location using aruino,gsm&gps
underground cable fault location using aruino,gsm&gps
 
Microprocessor-Architecture [8085]
Microprocessor-Architecture [8085]Microprocessor-Architecture [8085]
Microprocessor-Architecture [8085]
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver development
 
Jy3717961800
Jy3717961800Jy3717961800
Jy3717961800
 
rfio
rfiorfio
rfio
 

Recently uploaded

The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...Roi Lipman
 
BORESCOPE INSPECTION for engins CFM56.pdf
BORESCOPE INSPECTION for engins CFM56.pdfBORESCOPE INSPECTION for engins CFM56.pdf
BORESCOPE INSPECTION for engins CFM56.pdfomarzaboub1997
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...ShivamTiwari995432
 
Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdfKamal Acharya
 
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbineLow rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbineAftabkhan575376
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfJNTUA
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfragupathi90
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AISheetal Jain
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfJNTUA
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfMadan Karki
 
Introduction to Arduino Programming: Features of Arduino
Introduction to Arduino Programming: Features of ArduinoIntroduction to Arduino Programming: Features of Arduino
Introduction to Arduino Programming: Features of ArduinoAbhimanyu Sangale
 
Online crime reporting system project.pdf
Online crime reporting system project.pdfOnline crime reporting system project.pdf
Online crime reporting system project.pdfKamal Acharya
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Lovely Professional University
 
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Nitin Sonavane
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..MaherOthman7
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdfKamal Acharya
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1T.D. Shashikala
 
Lesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxLesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxmichaelprrior
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Prakhyath Rai
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsSheetal Jain
 

Recently uploaded (20)

The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
BORESCOPE INSPECTION for engins CFM56.pdf
BORESCOPE INSPECTION for engins CFM56.pdfBORESCOPE INSPECTION for engins CFM56.pdf
BORESCOPE INSPECTION for engins CFM56.pdf
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
 
Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdf
 
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbineLow rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
 
Introduction to Arduino Programming: Features of Arduino
Introduction to Arduino Programming: Features of ArduinoIntroduction to Arduino Programming: Features of Arduino
Introduction to Arduino Programming: Features of Arduino
 
Online crime reporting system project.pdf
Online crime reporting system project.pdfOnline crime reporting system project.pdf
Online crime reporting system project.pdf
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 
Lesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxLesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsx
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent Acts
 

L16 usart-atmega328 p

  • 1. Serial Communication in Atmega328P (Lecture-16) R S Ananda Murthy Associate Professor Department of Electrical & Electronics Engineering, Sri Jayachamarajendra College of Engineering, Mysore 570 006 R S Ananda Murthy Serial Communication in Atmega328P
  • 2. Serial and Parallel Communication Sender Receiver Sender Receiver D0 D7 : : : : : D0D1..D7 Serial Communication Parallel Communication R S Ananda Murthy Serial Communication in Atmega328P
  • 3. Serial versus Parallel Communication Serial Communication Bit-by-bit transmission. Requires parallel-to-serial conversion at the sending end and serial-to-parallel conversion at the receiving end. Requires lesser number of wires as compared to parallel communication. Serial high-speed communication is becoming possible now-a-days with improved hardware. RS232, RS485, SPI, USB, I2C and CAN – all these methods of communication employ serial communication. Parallel Communication Byte-by-byte transmission on eight data lines. Was popular in 1990s because of its then higher speed as compared serial communication. Not suitable for long distance communication as number of wires required is more. R S Ananda Murthy Serial Communication in Atmega328P
  • 4. Types of Serial Communication Synchronous Sender and receiver are driven by the same clock signal. SPI and I2C communication protocols are very common examples of synchronous serial communication. Transfers a block of data (several characters) in one operation. Asynchronous Sender and receiver are not driven by the same clock signal. Sender and receiver have to agree to operate at the same baud rate. Synchronization of sender and receiver is achieved by inserting START and STOP bits along with the data bits to form a data frame. Typically used to transmit a single character at a time. R S Ananda Murthy Serial Communication in Atmega328P
  • 5. Technical Terms Related to Serial Communication Baud Rate Bits per second. Simplex One-way communication. For example, Device-1 can send data to Device-2 and not vice versa. Full-duplex Two-way communication. Device-1 and 2 can both send and receive data simultaneously. Half-duplex Two-way communication, but not simultaneously. USART Universal Synchronous Asynchronous Receiver Transmitter. In most of the modern MCUs like Atmega328P this block is integrated on the chip. Data Frame Data bits along with START bit, STOP bit, and optional parity bit is called a data frame. Modem A device which converts 1s and 0s to audio tones used for serial communication on telephone lines. R S Ananda Murthy Serial Communication in Atmega328P
  • 6. Data Frame 0 1 0 0 0 0 0Stop Start1 D0D1D2D3D4D5D6D7 Mark Direction of transmission Framing of ASCII Charater `A' (0x41) for serial communication When there is no data transfer, the status of signal is 1 (high) which is also referred to as Mark. Transmission begins with a Start bit which is 0 (low), also called as Space. After this the data bits are transmitted in the order LSB to MSB and a STOP bit which is high (1). In some systems, a parity bit for even or odd parity is included in the data frame for data integrity. R S Ananda Murthy Serial Communication in Atmega328P
  • 7. RS232C Standard for Serial Communication Proposed by Electronics Industries Association in 1960s. Widely used for short distance serial communication even today. As per this standard, a voltage in the range −3 V to −25 V represents a logical high (1) and a voltage level in the range +3 V to +25 V represents a logical low (0). Since the voltage levels of this standard are not compatible with TTL levels used by MCUs such as Atmega328P, we need to use a voltage converter chip such as MAX232 or MAX233. R S Ananda Murthy Serial Communication in Atmega328P
  • 8. MAX232 Converter Chip R S Ananda Murthy Serial Communication in Atmega328P
  • 9. PC Serial Port Communication with MAX232 R S Ananda Murthy Serial Communication in Atmega328P
  • 10. Block Diagram of USART0 in Atmega328P R S Ananda Murthy Serial Communication in Atmega328P
  • 11. USART0 Pins of Atmega328P TxD On this pin serial data is transmitted by the USART0 RxD On this pin serial data is received by the USART0 XCK This pin is used for clock signal only during synchronous serial communication. R S Ananda Murthy Serial Communication in Atmega328P
  • 12. Serial Peripheral Interface (SPI) SPI Master SPI Slave SDO MOSI SDI SDI SDO SCLK SCLK SCK CE CE SS MISO MOSI – Master Out Slave In; MISO – Master In Slave Out; SCK – Serial Clock; SS – Slave Select SPI interface is typically used for short distance communication between two devices. R S Ananda Murthy Serial Communication in Atmega328P
  • 13. Serial Peripheral Interface (SPI) SPI, originally proposed by Motorola (now Freescale), uses four wires – SDI (also called MOSI), SDO (also called MISO), SCLK (also called SCK) , and CE (also called SS). In SPI, one device will be master and the other device/s will be slave/s. Master always starts the communication by activating SS and SCK. SPI Communication is full-duplex. In some systems SPI uses a common wire for both MOSI/MISO, thus reducing the number of wires to three. But such systems follow a different protocol for data transmission as compared to 4-wire SPI systems. R S Ananda Murthy Serial Communication in Atmega328P
  • 14. SPI Architecture When master wants to send a byte it places it in its shift register and issues 8 clock pulses. Then, the contents of the shift registers in the master and slave are interchanged. Clock input to the shift registers can be falling- or rising-edge triggered. R S Ananda Murthy Serial Communication in Atmega328P
  • 15. SPI Modes of Operation Write Operation (indicated by D7 = 1 of the first byte) Single-byte – write a byte to the slave. Multi-byte – write multiple bytes to the slave. Read Operation (indicated by D7 = 0 of the first byte) Single-byte – read a byte from the slave. Multi-byte – read multiple bytes from the slave Multi-byte operations are also known as burst mode operations. R S Ananda Murthy Serial Communication in Atmega328P
  • 16. Single-byte SPI Write Operation 1 Master places the bit pattern 1A6A5A4A3A2A1A0 in its shift register, makes SS = 0 to select the slave, and then issues 8 pulses of SCK to transfer it to the slave on the MOSI line. 2 Master issues 8 more pulses of SCK to shift a byte of data to the slave on the MOSI line and then makes SS = 1 to deselect the slave. R S Ananda Murthy Serial Communication in Atmega328P
  • 17. Single-byte SPI Read Operation 1 Master places the bit pattern 0A6A5A4A3A2A1A0 in its shift register, makes SS = 0 to select the slave, and then issues 8 pulses of SCK to transfer it to the slave on the MOSI line. 2 Master issues 8 more pulses of SCK to shift a byte of data from the slave on the MISO line and then makes SS = 1 to deselect the slave. R S Ananda Murthy Serial Communication in Atmega328P
  • 18. SPI Burst Mode Operations SPI Burst Mode Write Operation SPI Burst Mode Read Operation. In this mode, the address is automatically updated in the slave and the byte count is maintained in the master. R S Ananda Murthy Serial Communication in Atmega328P
  • 19. License This work is licensed under a Creative Commons Attribution 4.0 International License. R S Ananda Murthy Serial Communication in Atmega328P