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

ATMEGA169PV 参数 Datasheet PDF下载

ATMEGA169PV图片预览
型号: ATMEGA169PV
PDF下载: 下载PDF文件 查看货源
内容描述: 微控制器,带有16K字节的系统内可编程闪存 [Microcontroller with 16K Bytes In-System Programmable Flash]
分类和应用: 闪存微控制器
文件页数/大小: 390 页 / 3485 K
品牌: ATMEL [ ATMEL ]
 浏览型号ATMEGA169PV的Datasheet PDF文件第178页浏览型号ATMEGA169PV的Datasheet PDF文件第179页浏览型号ATMEGA169PV的Datasheet PDF文件第180页浏览型号ATMEGA169PV的Datasheet PDF文件第181页浏览型号ATMEGA169PV的Datasheet PDF文件第183页浏览型号ATMEGA169PV的Datasheet PDF文件第184页浏览型号ATMEGA169PV的Datasheet PDF文件第185页浏览型号ATMEGA169PV的Datasheet PDF文件第186页  
Assembly Code Example(1)  
USART_Receive:  
; Wait for data to be received  
sbis UCSR0A, RXC0  
rjmp USART_Receive  
; Get status and 9th bit, then data from buffer  
in  
in  
in  
r18, UCSR0A  
r17, UCSR0B  
r16, UDR0  
; If error, return -1  
andi r18,(1<<FE0)|(1<<DOR0)|(1<<UPE0)  
breq USART_ReceiveNoError  
ldi r17, HIGH(-1)  
ldi r16, LOW(-1)  
USART_ReceiveNoError:  
; Filter the 9th bit, then return  
lsr r17  
andi r17, 0x01  
ret  
C Code Example(1)  
unsigned int USART_Receive( void )  
{
unsigned char status, resh, resl;  
/* Wait for data to be received */  
while ( !(UCSRnA & (1<<RXCn)) )  
;
/* Get status and 9th bit, then data */  
/* from buffer */  
status = UCSR0A;  
resh = UCSR0B;  
resl = UDR0;  
/* If error, return -1 */  
if ( status & (1<<FE0)|(1<<DOR0)|(1<<UPE0) )  
return -1;  
/* Filter the 9th bit, then return */  
resh = (resh >> 1) & 0x01;  
return ((resh << 8) | resl);  
}
Note:  
1. ”About Code Examples” on page 9  
The receive function example reads all the I/O Registers into the Register File before any com-  
putation is done. This gives an optimal receive buffer utilization since the buffer location read will  
be free to accept new data as early as possible.  
182  
ATmega169P  
8018A–AVR–03/06  
 复制成功!