Summary of Serial communication (USART) with different frame size using AVR microcontroller
This article explains configuring AVR microcontroller serial communication for 5, 6, 7, or 9-bit data frames to optimize efficiency. It details setting UCSZ bits in the UCSRC and UCSRB registers. A specific example demonstrates 6-bit transmission between a PC and microcontroller using HyperTerminal. The text highlights that while numeric ASCII codes work correctly in 6-bit mode, alphabetic characters may display incorrectly because their two most significant bits are masked during reception.
Parts used in the AVR Microcontroller Serial Communication Project:
- AVR Microcontroller
- PC with COM port
- HyperTerminal software
- User keyboard input
- USART module
- UCSRC Register
- UCSRB Register
The previous article explains serial communication using 8-bit data transfer. AVR microcontroller also supports serial data transfer with frame size of 5, 6, 7 and 9 data bits. The size of data frame can be adjusted according to application. For example, consider a system that needs to transmit only ASCII codes as data. In this case data frame size of 7-bits is sufficient because data length of ASCII code is equal to 7-bit. This will makes system more efficient by saving time of one clock period in each data frame transmission. This article explains serial transfer of data with different frame size.
- How can the data frame size be adjusted?
The frame size is selected by configuring the UCSZ bits in the UCSRC and UCSRB registers. - What is the benefit of using a 7-bit frame for ASCII codes?
It saves one clock period per transmission, making the system more efficient. - Which register bits control 5, 6, and 7-bit frame sizes?
Only the UCSZ1 and UCSZ0 bits in the UCSRC register need programming for these sizes. - Why do alphabetic keys show symbols instead of letters in 6-bit mode?
The two most significant bits of the character are masked to zero, altering the ASCII value. - What COM port settings are required for the 6-bit experiment?
Set Baud rate to 9600 bps, data bit to 6, Parity to None, and Stop bit to 1. - Does the programming logic change for different frame sizes?
No, the steps for sending and receiving data remain the same as 8-bit transmission. - What happens to the most significant bits when reading from UDR in 6-bit mode?
The two most significant bits are masked to zero. - Can this method transmit only ASCII codes efficiently?
Yes, a 7-bit frame is sufficient and efficient for transmitting standard ASCII codes.


