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

ATMEGA16L-8MI 参数 Datasheet PDF下载

ATMEGA16L-8MI图片预览
型号: ATMEGA16L-8MI
PDF下载: 下载PDF文件 查看货源
内容描述: 8位AVR微控制器具有16K字节的系统内可编程闪存 [8-bit AVR Microcontroller with 16K Bytes In-System Programmable Flash]
分类和应用: 闪存微控制器和处理器外围集成电路异步传输模式ATM时钟
文件页数/大小: 315 页 / 2880 K
品牌: ATMEL [ ATMEL ]
 浏览型号ATMEGA16L-8MI的Datasheet PDF文件第144页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第145页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第146页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第147页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第149页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第150页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第151页浏览型号ATMEGA16L-8MI的Datasheet PDF文件第152页  
Receiving Frames with 9  
Databits  
If 9 bit characters are used (UCSZ=7) the ninth bit must be read from the RXB8 bit in  
UCSRB before reading the low bits from the UDR. This rule applies to the FE, DOR and  
PE status flags as well. Read status from UCSRA, then data from UDR. Reading the  
UDR I/O location will change the state of the receive buffer FIFO and consequently the  
TXB8, FE, DOR and PE bits, which all are stored in the FIFO, will change.  
The following code example shows a simple USART receive function that handles both  
9-bit characters and the status bits.  
Assembly Code Example(1)  
USART_Receive:  
; Wait for data to be received  
sbis UCSRA, RXC  
rjmp USART_Receive  
; Get status and 9th bit, then data from buffer  
in  
in  
in  
r18, UCSRA  
r17, UCSRB  
r16, UDR  
; If error, return -1  
andi r18,(1<<FE)|(1<<DOR)|(1<<PE)  
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 ( !(UCSRA & (1<<RXC)) )  
;
/* Get status and 9th bit, then data */  
/* from buffer */  
status = UCSRA;  
resh = UCSRB;  
resl = UDR;  
/* If error, return -1 */  
if ( status & (1<<FE)|(1<<DOR)|(1<<PE) )  
return -1;  
/* Filter the 9th bit, then return */  
resh = (resh >> 1) & 0x01;  
return ((resh << 8) | resl);  
}
Note:  
1. The example code assumes that the part specific header file is included.  
148  
ATmega16(L)  
2466E–AVR–10/02  
 复制成功!