ATmega16A microcontroller UBRRH and UCSRC description

Publisher:灵感火花Latest update time:2020-03-06 Source: eefocusKeywords:ATmega16A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction: There is one thing to note about the ATMEGA16 serial port. The UBRRH and UCSRC registers use the same IO address, so be careful when setting and reading.

The UCSRC and UBRRH registers of the microcontroller UART share the same address, and the highest bit URSEL is used to select which data to update. For example: if you write UCSRC=0x86, then the highest bit Bit7 of 0x86=1, so this set of data will update the value of UCSRC; if you write UBRRH=0x01, then the highest bit Bit7 of 0x01=0, so this set of data will update the value of UBRRH without specifically updating the value of URSEL. If you write UBRRH=0x81, then the value of UCSRC will be updated, which is automatically recognized. I saw a friend asking online: Why didn't you set URSEL to 0 when writing UBRRH in the program? Instead, you directly set UBRRH=BAUD_H;UBRRL=BAUD_L; Now everyone should understand that as long as the highest bit of BUAD_H written is 0, that is, AUD_H&0x80==0, the value of UBRRH will be automatically updated without the need to specifically set the value of URSEL.


Below I give the serial port initialization code I use, which is very easy to understand. Combined with the text above, the initial code sets the baud rate to 115200. My microcontroller crystal oscillator is 16MHZ. The value of UBRR can be found in the AVR manual.


Keywords:ATmega16A Reference address:ATmega16A microcontroller UBRRH and UCSRC description

Previous article:Design of vehicle side slip detection device based on ATmega16
Next article:Design of low-cost GPS receiving system based on ATmega16A

Recommended ReadingLatest update time:2024-11-16 20:44

CoreShine Technology launches China Mobile's first RISC-V low-power, high-capacity MCU chip
On December 17, at the first Dishui Lake China RISC-V Industry Forum, Wang Bin, MCU Product Manager of CoreSheng Technology Co., Ltd., introduced the company's CM32M43xR series of products, which is China Mobile's first RISC-V low-power, large-capacity MCU chip. According to Wang Bin, Xinsheng Technology is a wholly-o
[Mobile phone portable]
CoreShine Technology launches China Mobile's first RISC-V low-power, high-capacity MCU chip
Design of dry-type transformer intelligent controller system using ATmega16 microcontroller
1 Working Principle The temperature controller consists of three parts: temperature monitoring, signal processing, and output control. The system block diagram is shown in Figure 1. It obtains the winding temperature value through three platinum resistance sensors embedded in the three-phase winding of the tra
[Microcontroller]
Design of dry-type transformer intelligent controller system using ATmega16 microcontroller
51 MCU special function register and bit definition
In the next few sections, we will show you how to write your first MCU program. Before that, let's first understand some of the 51 MCU's unique program syntax and the basic operating steps of Keil software. Please be patient. We mainly use C language to program the MCU, and some MCU have a few very special and unique
[Microcontroller]
51 MCU special function register and bit definition
Single chip LED digital circuit and C program
Let a single-chip LED digital display display 1 from the first digit, 2 from the second digit, 3 from the third digit, ... until the sixth digit displays 6, with an interval of 0.5 seconds between each digit. Then keep looping. Find a C language program! ---------------------------- Assume the circuit is as shown belo
[Microcontroller]
Single chip LED digital circuit and C program
MCS-51 single-chip microcomputer single-step working mode
     MCS-51 has a single-step working mode. The so-called single-step execution is to control the execution of the program by external pulses, so that it can execute a line of instructions for each pulse. The external pulse is generated by a key, so in fact, the microcontroller executes one instruction by pressing a ke
[Microcontroller]
MCS-51 single-chip microcomputer single-step working mode
Design of single chip PWM + infrared tube control DC motor
The design uses a special chip to form a PWM signal generation system and explains in detail the principle and generation method of PWM signals and how to adjust the PWM signal duty cycle through software programming to control its input signal waveform. In addition, this system uses an infrared tube to measure the sp
[Microcontroller]
Design of single chip PWM + infrared tube control DC motor
Simple fingerprint lock source program based on AS608 and 51 single chip microcomputer
My roommate always forgets to bring his keys, so I made a simple fingerprint lock. Six people in the dormitory use it. This is the first time I upload it. It's quite crude. I wrote a very detailed comment (I think). If it can help you, it will be great. The microcontroller source program is as follows: #include r
[Microcontroller]
Using VB to realize the communication between PC and multiple single-chip microcomputers
Preface In the data acquisition automation control system with PC as the control center, the single-chip microcomputer is usually required to collect data, and then transmit it to the PC by asynchronous serial communication. The PC performs timing control on the single-chip microcomputer, which requires mul
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号