欢迎访问ic37.com |
会员登录 免费注册
发布采购

ATMEGA64A-AU 参数 Datasheet PDF下载

ATMEGA64A-AU图片预览
型号: ATMEGA64A-AU
PDF下载: 下载PDF文件 查看货源
内容描述: 8位微控制器,带有64K字节的系统内可编程闪存 [8-bit Microcontroller with 64K Bytes In-System Programmable Flash]
分类和应用: 闪存微控制器
文件页数/大小: 392 页 / 7964 K
品牌: ATMEL [ ATMEL ]
 浏览型号ATMEGA64A-AU的Datasheet PDF文件第176页浏览型号ATMEGA64A-AU的Datasheet PDF文件第177页浏览型号ATMEGA64A-AU的Datasheet PDF文件第178页浏览型号ATMEGA64A-AU的Datasheet PDF文件第179页浏览型号ATMEGA64A-AU的Datasheet PDF文件第181页浏览型号ATMEGA64A-AU的Datasheet PDF文件第182页浏览型号ATMEGA64A-AU的Datasheet PDF文件第183页浏览型号ATMEGA64A-AU的Datasheet PDF文件第184页  
ATmega64A  
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 TXCn flag can be used  
to check that the Transmitter has completed all transfers, and the RXCn flag can be used to  
check that there are no unread data in the receive buffer. Note that the TXCn flag must be  
cleared before each transmission (before UDRn 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  
registers.  
Assembly Code Example(1)  
USART_Init:  
; Set baud rate  
out  
out  
UBRRnH, r17  
UBRRnL, r16  
; Enable receiver and transmitter  
ldi  
out  
r16, (1<<RXENn)|(1<<TXENn)  
UCSRnB,r16  
; Set frame format: 8data, 2stop bit  
ldi  
out  
ret  
r16, (1<<USBSn)|(3<<UCSZn0)  
UCSRnC,r16  
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 */  
UBRRnH = (unsigned char)(ubrr>>8);  
UBRRnL = (unsigned char)ubrr;  
/* Enable receiver and transmitter */  
UCSRnB = (1<<RXENn)|(1<<TXENn);  
/* Set frame format: 8data, 2stop bit */  
UCSRnC = (1<<USBSn)|(3<<UCSZn0);  
}
Note:  
1. See “About Code Examples” on page 8.  
180  
8160C–AVR–07/09  
 复制成功!