欢迎访问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文件第178页浏览型号ATMEGA64A-AU的Datasheet PDF文件第179页浏览型号ATMEGA64A-AU的Datasheet PDF文件第180页浏览型号ATMEGA64A-AU的Datasheet PDF文件第181页浏览型号ATMEGA64A-AU的Datasheet PDF文件第183页浏览型号ATMEGA64A-AU的Datasheet PDF文件第184页浏览型号ATMEGA64A-AU的Datasheet PDF文件第185页浏览型号ATMEGA64A-AU的Datasheet PDF文件第186页  
ATmega64A  
The function simply waits for the transmit buffer to be empty by checking the UDREn flag, before  
loading it with new data to be transmitted. If the Data Register Empty Interrupt is utilized, the  
interrupt routine writes the data into the buffer.  
20.6.2  
Sending Frames with 9 Data Bits  
If 9-bit characters are used (UCSZn = 7), the ninth bit must be written to the TXB8n bit in  
UCSRnB before the low byte of the character is written to UDRn. The following code examples  
show a transmit function that handles 9-bit characters. For the assembly code, the data to be  
sent is assumed to be stored in registers r17:r16.  
Assembly Code Example(1)  
USART_Transmit:  
; Wait for empty transmit buffer  
sbis UCSRnA,UDREn  
rjmp USART_Transmit  
; Copy ninth bit from r17 to TXB8  
cbi  
UCSRnB,TXB8n  
sbrc r17,0  
sbi  
UCSRnB,TXB8n  
; Put LSB data (r16) into buffer, sends the data  
out  
ret  
UDRn,r16  
C Code Example(1)  
void USART_Transmit( unsigned int data )  
{
/* Wait for empty transmit buffer */  
while ( !( UCSRnA & (1<<UDREn)) )  
;
/* Copy ninth bit to TXB8 */  
UCSRnB &= ~(1<<TXB8n);  
if ( data & 0x0100 )  
UCSRnB |= (1<<TXB8n);  
/* Put data into buffer, sends the data */  
UDRn = data;  
}
Note:  
1. These transmit functions are written to be general functions. They can be optimized if the con-  
tents of the UCSRnB is static. For example, only the TXB8n bit of the UCSRnB Register is  
used after initialization.  
For I/O Registers located in extended I/O map, “IN”, “OUT”, “SBIS”, “SBIC”, “CBI”, and “SBI”  
instructions must be replaced with instructions that allow access to extended I/O. Typically  
“LDS” and “STS” combined with “SBRS”, “SBRC”, “SBR”, and “CBR”.  
The ninth bit can be used for indicating an address frame when using Multi-processor Communi-  
cation mode or for other protocol handling as for example synchronization.  
20.6.3  
Transmitter Flags and Interrupts  
The USART Transmitter has two flags that indicate its state: USART Data Register Empty  
(UDREn) and Transmit Complete (TXCn). Both flags can be used for generating interrupts.  
182  
8160C–AVR–07/09  
 复制成功!