You Are Here: Home » AVR ATmega Projects » Interfacing(USB - RS232 - I2c -ISP) Projects » Serial communication (Data receive) using AVR Microcontroller (ATmega16) USART

Serial communication (Data receive) using AVR Microcontroller (ATmega16) USART

Communication between two entities is important for the information flow to take place. In general the information transport system can be parallel in which the complete byte of data is sent at a time, with each bit having a separate dedicated line or it can be serial where only one communication line is available which is shared by all the bits sequentially. The pros and cons of these two systems are equivalent and selection between the two depends on the application.
Serial communication (Data receive) using AVR Microcontroller (ATmega16) USART
Data can be exchanged using parallel or serial techniques. Setup for parallel data transfer is not cost effective but is a very fast method of communication. Serial communication is cost effective because it requires only a single line of connection but on the other hand is a slow process in comparison to parallel communication. This article explains serial communication of AVR microcontroller (ATmega16) with PC. The data is transmitted from the controller using RS232 standard and displayed on the PC using Hyper Terminal.

There are two methods for serial data communication (i) Synchronous and (ii) Asynchronous communication. In Synchronous communication method complete block (characters) is sent at a time. It doesn’t require any additional bits (start, stop or parity) to be added for the synchronization of frame. The devices are synchronized by clock. And in asynchronous communication data transmission is done byte by byte i.e., one byte at a time. The additional bits are added to complete a frame.

In synchronous communication the frame consists of data bits while in asynchronous communication the total number of bits in a frame may be more than the data bits.
There are three ways in which serial communication can be done
        i.           Simplex: Transmission is done in one direction.
      ii.           Half duplex: Transmission can be done in both the direction but one side at a time.
    iii.           Full duplex: Transmission can be done in both the direction simultaneously.
Atmega16 is equipped with three different kinds of serial communication peripheral systems:
        i.            Serial USART
      ii.            SPI (Serial Peripheral Interface)
     iii.            TWI (Two wire Interface)
SERIAL USART (universal synchronous asynchronous receiver and transmission/ transmitter):
Serial USART provides full-duplex communication between the transmitter and receiver. Atmega16 is equipped with independent hardware for serial USART communication. Pin-14 (RXD) and Pin-15 (TXD) provide receive and transmit interface to the microcontroller.
Atmega16 USART provides asynchronous mode of communication and do not have a dedicated clock line between the transmitting and receiving end. The synchronization is achieved by properly setting the baud rate, start and stop bits in a transmission sequence.
Start bit and stop bit: These bits are use to synchronize the data frame. Start bit is one single low bit and is always given at the starting of the frame, indicating the next bits are data bits. Stop bit can be one or two high bits at the end of frame, indicating the completion of frame.
Serial communication (Data receive) using AVR Microcontroller (ATmega16) USART schematic
Baud Rate: In simple words baud rate is the rate at which serial data is being transferred.
Atmega16 USART has following features:
·         Different Baud Rates.
·         Variable data size with options ranging from 5bits to 9bits.
·         One or two stop bits.
·         Hardware generated parity check.
·         USART can be configured to operate in synchronous mode.
·         Three separate interrupts for RX Complete, TX complete and TX data register empty.
USART Registers
To use the USART of Atmega16, certain registers need to be configured.
UCSR: USART control and status register. It’s is basically divided into three parts UCSRA, UCSRB and UCSRC. These registers are basically used to configure the USART.
UBRR: USART Baud Rate Registers. Basically use to set the baud rate of USART
UDR: USART data register

Leave a Comment

You must be logged in to post a comment.

Read previous post:
How to interface AVR microcontroller with PC using USART (RS232 protocol)
How to interface AVR microcontroller with PC using USART (RS232 protocol)

This article covers data transmission using 8 bit USART. The readers should have a basic understanding of serial communication and...

Scroll to top