поискавой системы для электроныых деталей
  Russian  ▼
ALLDATASHEETRU.COM

X  

ATmega162 датащи(PDF) 172 Page - ATMEL Corporation

номер детали ATmega162
подробное описание детали  8-bit Microcontroller with 16K Bytes In-System Programmable Flash
PDF  324 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
производитель  ATMEL [ATMEL Corporation]
домашняя страница  http://www.atmel.com
Logo ATMEL - ATMEL Corporation

ATmega162 датащи(HTML) 172 Page - ATMEL Corporation

Back Button ATmega162 Datasheet HTML 168Page - ATMEL Corporation ATmega162 Datasheet HTML 169Page - ATMEL Corporation ATmega162 Datasheet HTML 170Page - ATMEL Corporation ATmega162 Datasheet HTML 171Page - ATMEL Corporation ATmega162 Datasheet HTML 172Page - ATMEL Corporation ATmega162 Datasheet HTML 173Page - ATMEL Corporation ATmega162 Datasheet HTML 174Page - ATMEL Corporation ATmega162 Datasheet HTML 175Page - ATMEL Corporation ATmega162 Datasheet HTML 176Page - ATMEL Corporation Next Button
Zoom Inzoom in Zoom Outzoom out
 172 / 324 page
background image
172
2513K–AVR–07/09
ATmega162/V
USART
Initialization
The USART has to be initialized before any communication can take place. The initialization pro-
cess 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 func-
tion that are equal in functionality. The examples assume asynchronous operation 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 Regis-
ters. 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:
1. See “About Code Examples” on page 8.
Assembly Code Example
(1)
USART_Init:
; Set baud rate
out
UBRRH, r17
out
UBRRL, r16
; Enable receiver a?d transmitter
ldi
r16, (1<<RXEN)|(1<<TXEN)
out
UCSRB,r16
; Set frame format:?8data, 2stop bit
ldi
r16, (1<<URSEL)|(1<<USBS)|(3<<UCSZ0)
out
UCSRC,r16
ret
C Code Example(1)
#define FOSC 1843200// Clock Speed
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1
void
main( void )
{
...
USART_Init ( MYUBRR );
...
}
void
USART_Init( unsigned int ubrr )
{
/* Set baud rate */
UBRRH = (unsigned c?ar)(ubrr>>8);
UBRRL = (unsigned c?ar)ubrr;
/* Enable receiver ?nd transmitter */
UCSRB = (1<<RXEN)|(1<<TX?N);
/* Set frame format? 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<U?BS)|(3<<UCSZ0);
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


датащи скачать

Go To PDF Page


ссылки URL



Вашему бизинису помогли Аллдатащит?  [ DONATE ] 

Что такое Аллдатащит   |   реклама   |   контакт   |   Конфиденциальность   |   Ссылка на техническое описание    |   обмен ссыками   |   поиск по производителю
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com