You Are Here: Home » AVR ATmega Programmers » UART Communication Between Two ATmega8 Microcontrollers

UART Communication Between Two ATmega8 Microcontrollers




In this tutorial we are going to establish a serial communication between two ATMEGA8 microcontrollers. The communication established here is UART (Universal Asynchronous Receiver Transmitter) type. By this serial communication data can be shared between two microcontrollers, which is required in various embedded systems.

UART Communication Between Two ATmega8 Microcontrollers

UART Communication Between Two ATmega8 Microcontrollers

Components Required

Hardware: ATMEGA8 (2 pieces), power supply (5v), AVR-ISP PROGRAMMER, 100uF capacitor (connected across power supply), 1KΩ resistor (two pieces), LED , Button.

Software: Atmel studio 6.1, progisp or flash magic.




Circuit Diagram & ExplanationSchematic UART Communication Between Two ATmega8 Microcontrollers

Let us understand the serial communication in AVR microcontrollers. Here ATMEGA sends data to the other ATMEGA in serial. It has other mode of communication but for easy communication we are choosing RS232. The RS232 pin of first ATMEGA8 is connected to RXD pin of second ATMEGA8.

The data communication established is programmed to have:

  1. Eight data bits
  2. Two stop bits
  3. No parity check bit
  4. Baud rate of 2400 BPS(Bits Per Second)
  5. Asynchronous communication (No clock share between two ATMEGA8)

So we have two set registers for two ATMEGA8 differently, where one acts as TRANSMITTER and other acts as RECEIVER.

Now for the RS232 interfacing between two ATmega microcontrollers, the following features must be satisfied for the TRANSMITTER and RECEIVER:

1. The TXD pin (data receiving feature) of first controller must be enabled for TRANSMITTER and RXD pin of second controller must be enabled for RECEIVER .

2. Since the communication is serial we need to know whenever the data byte is received, so that we can stop the program until complete byte is received. This is done by enabling a data receive complete interrupt.

3. DATA is transmitted and received to controller in 8bit mode. So two characters will be sent to the controller at a time.

4. There are no parity bits, one stop bit in the data sent by the module.

The above features are set in the controller registers; we are going to discuss them briefly,

For more detail: UART Communication Between Two ATmega8 Microcontrollers

Leave a Comment

You must be logged in to post a comment.

Read previous post:
100mA Ammeter using AVR Microcontroller
100mA Ammeter using AVR Microcontroller

In this project we are going to make a low range ammeter using ATMEGA8 microcontroller. In ATMEGA8, we are going...

Close
Scroll to top