欢迎访问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文件第180页浏览型号ATMEGA64A-AU的Datasheet PDF文件第181页浏览型号ATMEGA64A-AU的Datasheet PDF文件第182页浏览型号ATMEGA64A-AU的Datasheet PDF文件第183页浏览型号ATMEGA64A-AU的Datasheet PDF文件第185页浏览型号ATMEGA64A-AU的Datasheet PDF文件第186页浏览型号ATMEGA64A-AU的Datasheet PDF文件第187页浏览型号ATMEGA64A-AU的Datasheet PDF文件第188页  
ATmega64A  
The following code example shows a simple USART receive function based on polling of the  
Receive Complete n (RXCn) flag. When using frames with less than eight bits the most signifi-  
cant bits of the data read from the UDRn will be masked to zero. The USART has to be initialized  
before the function can be used.  
Assembly Code Example(1)  
USART_Receive:  
; Wait for data to be received  
sbis UCSRnA, RXCn  
rjmp USART_Receive  
; Get and return received data from buffer  
in  
r16, UDRn  
ret  
C Code Example(1)  
unsigned char USART_Receive( void )  
{
/* Wait for data to be received */  
while ( !(UCSRnA & (1<<RXCn)) )  
;
/* Get and return received data from buffer */  
return UDRn;  
}
Note:  
1. See “About Code Examples” on page 8.  
The function simply waits for data to be present in the receive buffer by checking the RXCn flag,  
before reading the buffer and returning the value.  
20.7.2  
Receiving Frames with 9 Data Bits  
If 9-bit characters are used (UCSZn=7) the ninth bit must be read from the RXB8n bit in  
UCSRnB before reading the low bits from the UDR. This rule applies to the FEn, DORn, and  
UPE status flags as well. Read status from UCSRnA, then data from UDRn. Reading the UDRn  
I/O location will change the state of the receive buffer FIFO and consequently the TXB8n, FEn,  
DORn, and UPEn bits, which all are stored in the FIFO, will change. The following code example  
shows a simple USART receive function that handles both nine bit characters and the status  
bits.  
184  
8160C–AVR–07/09  
 复制成功!