Datasheet

Table Of Contents
159
ATmega32A [DATASHEET]
Atmel-8155D-AVR-ATmega32A-Datasheet_02/2014
20.11.5 UBRRL and UBRRH – USART Baud Rate Registers
The UBRRH Register shares the same I/O location as the UCSRC Register. See the “Accessing UBRRH/ UCSRC
Registers” on page 165 section which describes how to access this register.
Bit 15 – URSEL: Register Select
This bit selects between accessing the UBRRH or the UCSRC Register. It is read as zero when reading UBRRH.
The URSEL must be zero when writing the UBRRH.
Bit 14:12 – Reserved Bits
These bits are reserved for future use. For compatibility with future devices, these bit must be written to zero when
UBRRH is written.
Bit 11:0 – UBRR11:0: USART Baud Rate Register
This is a 12-bit register which contains the USART baud rate. The UBRRH contains the four most significant bits,
and the UBRRL contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the trans-
mitter and receiver will be corrupted if the baud rate is changed. Writing UBRRL will trigger an immediate update of
the baud rate prescaler.
20.12 Examples of Baud Rate Setting
For standard crystal and resonator frequencies, the most commonly used baud rates for asynchronous operation
can be generated by using the UBRR settings in Table 19-9. UBRR values which yield an actual baud rate differing
less than 0.5% from the target baud rate, are bold in the table. Higher error ratings are acceptable, but the receiver
will have less noise resistance when the error ratings are high, especially for large serial frames (see “Asynchro-
nous Operational Range” on page 163). The error values are calculated using the following equation:
Bit 151413121110 9 8
URSEL UBRR[11:8] UBRRH
UBRR[7:0] UBRRL
76543210
Read/Write R/W R R R R/W R/W R/W R/W
R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value00000000
00000000
Error[%]
BaudRate
Closest Match
BaudRate
-------------------------------------------------------- 1


100%=
Table 20-9. Examples of UBRR Settings for Commonly Used Oscillator Frequencies
Baud
Rate
(bps)
f
osc
= 1.0000MHz f
osc
= 1.8432MHz f
osc
= 2.0000MHz
U2X = 0 U2X = 1 U2X = 0 U2X = 1 U2X = 0 U2X = 1
UBRR Error UBRR Error UBRR Error UBRR Error UBRR Error UBRR Error
2400 250.2%510.2%470.0%950.0%510.2%1030.2%
4800 120.2%250.2%230.0%470.0%250.2%510.2%
9600 6 -7.0% 12 0.2% 11 0.0% 23 0.0% 12 0.2% 25 0.2%
14.4k 3 8.5% 8 -3.5% 7 0.0% 15 0.0% 8 -3.5% 16 2.1%