Sie sind auf Seite 1von 4

Community

Register

News

Contact Us

Reviews

Guides & Tutorials

More

HOME EMBEDDED BASIC UART TUTORIAL

FOLLOW US

Basic UART Tutorial

FACEBOOK

OCFreaks.com
1.7Klikes

LikePage

SUBSCRIBE VIA EMAIL

Bethefirstofyourfriendstolikethis

Email Address

Subscribe

Introduction
Whenever we want to communicate between PC and MCU or between two MCUs , the simplest way to
achieve that is using UART. UART stands for Universal Asynchronous Receiver/Transmitter.
UART communication basically uses 2 pins for Data transfer and these are :
1. TxD (or Tx) which is the Transmit Data Pin used to send data
2. RxD (or Rx) which is the Receive Data Pin used to get data
UART sends & receives data in form of chunks or packets. These chunks or packets are also referred to
as transmission characters. The structure of a data packets is as shown below:

Uart data packet begins with a 0. This bit is also called as Start Bit which signies incoming data. Next
comes the actual data which can be 5 to 8 bits in length. After the data an optional parity bit can be
used for error checking. Lastly comes the Stop Bit(s) which is a 1 and this signies end of current data
packet. Note that either 1 or 2 stop bits can be used and the parity bit can be : Even , Odd , forced to 1
i.e. Mark parity , forced to 0 i.e. Space parity or None. (In UART/RS232 context a MARK means 1 and
SPACE means 0 , hence Marking state means a stream(series) of 1s and Spacing state means a
stream of 0s)
Here is an example of a packet having 8 data bits , odd parity bit and 2 stop bits :

Posted By Umang Gajera Posted date: November 26, 2013 in: Embedded 1 Comment
Search ...

Uart connections between dierent MCUs , Modules and


PC/Laptop

Interfacing PC or Laptop with a Microcontroller using


UART
Generally these days we interface Microcontrollers like lpc1768 , lpc2148 , AVRs , PICs , etc.. using USB
to Serial TTL module based on FTDIs FT232R Chip. The rst thing to take care is the voltage levels for
communication. Some microcontrollers like lpc2148 , lpc1768 , etc.. work on 3.3 Volts and others like
AVRs , PICs , etc.. work on 5V. Hence , you need to make sure that your module has appropriate voltage
levels for 3.3v MCUs or 5v MCUs.
On PC/Laptop side you need a software that can communicate with your microcontroller using via
Serial the communication Interface provided by your operating system. In windows this interface is
named as COMx for e.g COM1 , COM2 , and so on. In order for terminal softwares to communicate
you need to select the proper COM port. These COM port mappings can be found in device manager.
Right Click My Computer > Click on Manage > and Click on Device Manager and you will see a
window similar to what is given below :

In my case I am using a USB to Serial TTL module which is available as COM3 in windows. Finally you
need to congure your terminal software with baud rate and other information. For example, in
PuttyTel this done as shown below :

You can get PuttyTel from Here. Direct download link : Here.
Note : Both the communication ends must have same packet conguration and baud rate else it
wont work properly! For e.g. if one end is using [9600 bauds , 8 data bits , no parity , 1 stop
bit] then other end also must use this conguration.
LPC2148 Uart Tutorial is posted @ Here , Later on LPC1768 Uart Tutorial will be posted depends on
how much time I get

.. it might get delayed

Share this:

Share

Tags:

tutorial

Like

UART

Tweet

Share

Share

Share

Previous
Rumor:GTX Titan about to get a refresh?

Next
LPC2148 UART Programming Tutorial

ABOUT THE AUTHOR


Umang Gajera

1Comment
Recommend

OCFreaks!

Share

Login

SortbyNewest

Jointhediscussion

pandey.ketan3yearsago

Siristartedlearninguartbasicswithyourtutorialswhichhaveprovedtobeveryuseful.Asihaveto
designauartdriverfromscratchasmyprojectsoineedafeasibleprogrammingcodewithyour
explanationsandsuggestionsasearlyaspossibleforwhichiwillbehighlyobliged.

Reply Share
Subscribe d AddDisqustoyoursiteAddDisqusAdd

Privacy

(c) OCFreaks! 2014.

Community

Server Monitoring with Livewatch.de

Register

Contact Us

Das könnte Ihnen auch gefallen