beautypg.com

Baud rate generator, Atmega161(l) – Rainbow Electronics ATmega161L User Manual

Page 76

background image

76

ATmega161(L)

1228C–AVR–08/02

• Bit 2

CHR90/CHR91: 9-bit Characters

When this bit is set (one), transmitted and received characters are nine bits long, plus
start and stop bits. The ninth bit is read and written by using the RXB8n and TXB8 bits in
UCSRnB, respectively. The ninth data bit can be used as an extra stop bit or a parity bit.

• Bit 1

RXB80/RXB81: Receive Data Bit 8

When CHR9n is set (one), RXB8n is the ninth data bit of the received character.

• Bit 0

TXB80/TXB81: Transmit Data Bit 8

When CHR9n is set (one), TXB8n is the ninth data bit in the character to be transmitted.

Baud Rate Generator

The baud rate generator is a frequency divider that generates baud rates according to
the following equation:

BAUD = Baud rate

f

CK

= Crystal clock frequency

UBR = Contents of the UBRRH and UBRR Registers (0 - 4095)

Note that this equation is not valid when the UART transmission speed is doubled.
See “Double-speed Transmission” for a detailed description.

For standard crystal frequencies, the most commonly used baud rates can be generated
by using the UBR settings in Table 24. UBR values that yield an actual baud rate differ-
ing less than 2% from the target baud rate are boldface in the table. However, using
baud rates that have more than 1% error is not recommended. High error ratings give
less noise resistance.

BAUD

f

CK

16(UBR

1

)

+

----------------------------------

=