Serial Communication - Introduction Maxembedded
Serial Communication - Introduction Maxembedded
Join our newsletter today for free. Enter your email address Subscribe Now
×
maxEmbedded Index Categories » Tools Search This Site...
Search
Posted by Yash on Sep 3, 2013 in Atmel AVR, Getting Started, Microcontrollers
| 31 comments
Microcontrollers
Microcontrollers
Hey folks! Guess what? It’s now time for one of the THU LCD Interfacing with AVR
16
most desired tutorials on maxEmbedded – the Serial Posted by Mayank in Atmel AVR,
This post will cover the basics of serial communication and will be mostly a
theoretical topic. We will do some practical stu from next tutorial onwards. Browse maxE by Categories
Lets have a glance at the contents.
Select Category
Contents
What is Communication?
Why do we need Communication? Subscribe to maxEmbedded
Serial Communication
http://maxembedded.com/2013/09/serial-communication-introduction/ 1/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
Parallel CommunicationJoin our newsletter today for free. Enter your email address Subscribe
EmailNow
Address ×
Serial vs Parallel Communication
Major Factors Limiting Parallel Communication
Subscribe
Advantages of Serial over Parallel
How is Data sent Serially?
Serial Transmission Modes
Asynchronous Data Transfer
Like maxE on Facebook
Synchronous Data Transfer
Serial Communication Terminologies MaxEmbe…
4.4K likes
Importance of Baud Rate
The Catch in Serial Communication
UART and USART
Like Page
Serial Communication Protocols
Lets take another example. This one’s a more common example. You have a
le in your mobile and you would like to share it with your friend who is
sitting next to you? How would you do it – Bluetooth, IR, NFC, LAN or email?
Mostly people would use Bluetooth. IR is obsolete, NFC is still in
developmental phase and isn’t available in most devices, LAN needs a
WiFi/LAN network whereas email requires an active Internet connection.
The same questions can be put forth here as well – how is it send, from
where is it sent and to where, what is being sent and how is it processed?!
Serial Communication
http://maxembedded.com/2013/09/serial-communication-introduction/ 2/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
Join our newsletter today for free. Enter your email address Subscribe Now
×
Serial Transfer
Parallel Communication
Parallel Transfer
Serial vs Parallel
http://maxembedded.com/2013/09/serial-communication-introduction/ 3/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
http://maxembedded.com/2013/09/serial-communication-introduction/ 4/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
http://maxembedded.com/2013/09/serial-communication-introduction/ 5/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
Lets take an analogy. Imagine you are playing a game with your friend
where you have to throw colored balls (let’s say we have only two colors –
red (R) and yellow (Y)). Lets assume you have unlimited number of balls. You
have to throw a combination of these colored balls to your friend. So you
start throwing the balls. You throw R, then R, then Y, then R again and so on.
So you start your sequence RRYR… and then you end your round and start
another round. How will your buddy on the other side know that you have
nished sending him rst round of balls and that you are already sending
him the second round of balls?? He/she will be completely lost! How nice it
would be if you both sit together and x a protocol that each round consists
of 8 balls! After every 8 balls, you will throw two R balls to ensure that your
friend has caught up with you, and then you again start your second round
of 8 balls. This is what we call asynchronous data transfer.
The rst bit is always the START bit (which signi es the start of
communication on the serial line), followed by DATA bits (usually 8-bits),
followed by a STOP bit (which signals the end of data packet). There may
be a Parity bit just before the STOP bit. The Parity bit was earlier used for
error checking, but is seldom used these days.
The START bit is always low (0) while the STOP bit is always high (1).
We will take the same analogy as before. You are still playing the throw-ball
game, but this time, you have set a timer in your watch such that it beeps
every minute. You will not throw a ball unless you hear a beep from your
watch. As soon as you hear a beep from your watch, you and your friend,
both know that you are going to throw a ball to her. Both of you can keep a
track of time using this; say you start a new round after every 8 beeps. Isn’t
it a much better approach? This approach is what we call synchronous data
transfer.
Join our newsletter today for free. Enter your email address
The basic principle is that data bit sampling (or in other words, say,
Subscribe Now
×
‘recording’) is done with respect to clock pluses, as you can see in the
timing diagrams.
Since data is sampled depending upon clock pulses, and since the clock
sources are very reliable, so there is much less error in synchronous as
compared to asynchronous.
1. MSB/LSB: this stands for Most Signi cant Bit (or Least Signi cant Bit).
You can refer to Mayank’s this post for more information on MSB and LSB.
Since data is transferred bit-by-bit in serial communication, one needs to
know which bit is sent out rst: MSB or LSB.
2. Simplex Communication: In this mode of serial communication, data
can only be transferred from transmitter to receiver and not vice versa.
3. Half Duplex Communication: this means that data transmission can
occur in only one direction at a time, i.e. either from master to slave, or
slave to master, but not both.
4. Full Duplex Communication: full duplex communication means that
data can be transmitted from the master to the slave, and from slave to
the master as the same time!
Types of Transmission
as baud or modulation
Joinrate. However, though
our newsletter today for free.technically incorrect,
Enter your in the
email address Subscribe Now
×
case of modem manufacturers baud commonly refers to bits per second.
Di erent baud rates are available for use. The most common ones are 2400,
4800, 9600, 19200, 38400 etc. You cannot choose any arbitrary baud rate,
there are some xed values which you must use like 2400, 4800, etc. Please
note that the unit of baud rate is bps (bits per second).
1. Baud Rate: Unless the baud rate of both the transmitter and receiver
are the same, serial communication cannot work. The reason is speci ed
in the previous section.
2. Address: If you are trying to send multiple data together over the same
channel and/or you are sharing the same channel space with other users
sending their own data, then you need to take care to properly address
your data. We won’t discuss about it in this post, but we will surely discuss
about it in one of our upcoming posts.
If you take care of these two factors, your serial communication will be
established perfectly and your data will go through properly. These are the
two main reasons for unsuccessful serial link.
http://maxembedded.com/2013/09/serial-communication-introduction/ 8/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
http://maxembedded.com/2013/09/serial-communication-introduction/ 9/18
10/25/2018 Serial Communication - Introduction » maxEmbedded
Join our newsletter today for free. Enter your email address Subscribe Now
×
USB Pins
So that is it for now folks! We will be discussing about RS-232 and its basics
in the next post! Don’t forget to post your comments and questions
down below! And yes, subscribe to maxEmbedded and stay tuned! :)
Written By-
Yash Tambi
VIT University, Vellore
[email protected]
Like this:
Like
Related
The USART of the AVR Serial Communication - The SPI of the AVR
September 30, 2013 RS232 Basics November 26, 2013
September 21, 2013
In "Atmel AVR" In "Atmel AVR"
In "Atmel AVR"
http://maxembedded.com/2013/09/serial-communication-introduction/ 10/18