ATMEGA162L-8MI Atmel, ATMEGA162L-8MI Datasheet - Page 169

IC MCU AVR 16K 3V 8MHZ 44-QFN

ATMEGA162L-8MI

Manufacturer Part Number
ATMEGA162L-8MI
Description
IC MCU AVR 16K 3V 8MHZ 44-QFN
Manufacturer
Atmel
Series
AVR® ATmegar
Datasheets

Specifications of ATMEGA162L-8MI

Core Processor
AVR
Core Size
8-Bit
Speed
8MHz
Connectivity
EBI/EMI, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, POR, PWM, WDT
Number Of I /o
35
Program Memory Size
16KB (8K x 16)
Program Memory Type
FLASH
Eeprom Size
512 x 8
Ram Size
1K x 8
Voltage - Supply (vcc/vdd)
2.7 V ~ 5.5 V
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
44-VQFN Exposed Pad
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
Data Converters
-
USART Initialization
2513C–AVR–09/02
If used, the parity bit is located between the last data bit and first stop bit of a serial
frame.
The USART has to be initialized before any communication can take place. The initial-
ization process normally consists of setting the baud rate, setting frame format and
enabling the Transmitter or the Receiver depending on the usage. For interrupt driven
USART operation, the Global Interrupt Flag should be cleared (and interrupts globally
disabled) when doing the initialization.
Before doing a re-initialization with changed baud rate or frame format, be sure that
there are no ongoing transmissions during the period the registers are changed. The
TXC flag can be used to check that the Transmitter has completed all transfers, and the
RXC flag can be used to check that there are no unread data in the receive buffer. Note
that the TXC flag must be cleared before each transmission (before UDR is written) if it
is used for this purpose.
The following simple USART initialization code examples show one assembly and one
C function that are equal in functionality. The examples assume asynchronous opera-
tion using polling (no interrupts enabled) and a fixed frame format. The baud rate is
given as a function parameter. For the assembly code, the baud rate parameter is
assumed to be stored in the r17:r16 registers. When the function writes to the UCSRC
Register, the URSEL bit (MSB) must be set due to the sharing of I/O location by UBRRH
and UCSRC.
Note:
More advanced initialization routines can be made that include frame format as parame-
ters, disable interrupts and so on. However, many applications use a fixed setting of the
Assembly Code Example
C Code Example
USART_Init:
void USART_Init( unsigned int baud )
{
}
; Set baud rate
out
out
; Enable receiver and transmitter
ldi
out
; Set frame format: 8data, 2stop bit
ldi
out
ret
/* Set baud rate */
UBRRH = (unsigned char)(baud>>8);
UBRRL = (unsigned char)baud;
/* Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
1. The example code assumes that the part specific header file is included.
UBRRH, r17
UBRRL, r16
r16, (1<<RXEN)|(1<<TXEN)
UCSRB,r16
r16, (1<<URSEL)|(1<<USBS)|(3<<UCSZ0)
UCSRC,r16
(1)
(1)
ATmega162(V/U/L)
169

Related parts for ATMEGA162L-8MI