Serial Communication (USART) in AVR ATmega16 Mini Development Board

The USART module of ATmega16 uses pins PD0 & PD1 for reception & transmission respectively. The mini development board can communicate with PC/external modules through

  1. USB port via CP2102
  2. Serial port via MAX232
  3. RMC connector  K10 in 5V level
  4. RMC connector  K16 in 3.3V level

Besides, USART is also used for interfacing Zigbee & RFID reader.

Note :

  1. USART communication via USB/serial port is selected using jumpers J1 & J2
  2. Short jumpers J13 & J14 while using 3V3 USART / Zigbee
  3. Remove jumpers J1 & J2 while using Zigbee / RFID / UART (3V3/ 5V)

Schematic

Sample Code

The sample code to check USART module is given below. Initially the letter ‘A’  gets transmitted. Then, upon receiving a character, the same gets retransmitted.

Value in UBRR is calculated as follows
           UBRR = (Fosc / (16 * BAUD)) – 1

The desired baudrate is 9600 bps and crystal frequency, Fosc is 8 MHz. This gives UBRR = 51. Any change in crystal frequency/baudrate  changes this value as per the above equation.


Output

The following screenshots explain how to test the sample code using RealTerm (click to download).

  • Step 1: Open  RealTerm

  • Step 2: RealTerm opens as shown below

  •  Step 3: Go to ‘Port’ option, set correct baudrate (which is set as 9600 in the sample code) and correct port

  •  Step 4: Click ‘Change’ (encircled in red) to apply the changes. Now check the status of Port. If it is closed, click ‘Open’ button (encircled in green) to open it.

  • Step 5: To check reception, go to Send option, type the string in the space provided(encircled in green) and click Send ASCII button. The first “hello” in green colour is  transmitted from PC & that in yellow colour is retransmitted by the controller

Topics related to AVR ATmega16 Mini Development Board

  1. AVR ATmega16 Mini Development Board – Overview
  2. AVR ATmega16 Mini Development Board - Interfacing LED
  3. AVR ATmega16 Mini Development Board – Interfacing LCD
  4. AVR ATmega16 Mini Development Board – Serial communication(USART)
  5. AVR ATmega16 Mini Development Board – Interfacing Switch
  6. AVR ATmega16 Mini Development Board – Interfacing Buzzer
  7. AVR ATmega16 Mini Development Board - Interfacing POT(ADC)
  8. AVR ATmega16 Mini Development Board – Interfacing Temperature sensor
  9. AVR ATmega16 Mini Development Board – Interfacing Servo Motor
  10. AVR ATmega16 Mini Development Board – Interfacing  μRFID

Resources

How to buy?

SupportPlease share your ideas with us, visit our forum for discussion

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">