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

MEGA128CAN 参数 Datasheet PDF下载

MEGA128CAN图片预览
型号: MEGA128CAN
PDF下载: 下载PDF文件 查看货源
内容描述: 微控制器,带有ISP功能的Flash和CAN控制器128K字节 [Microcontroller WITH 128K BYTES OF ISP FLASH AND CAN CONTROLLER]
分类和应用: 微控制器
文件页数/大小: 413 页 / 5507 K
品牌: ATMEL [ ATMEL ]
 浏览型号MEGA128CAN的Datasheet PDF文件第173页浏览型号MEGA128CAN的Datasheet PDF文件第174页浏览型号MEGA128CAN的Datasheet PDF文件第175页浏览型号MEGA128CAN的Datasheet PDF文件第176页浏览型号MEGA128CAN的Datasheet PDF文件第178页浏览型号MEGA128CAN的Datasheet PDF文件第179页浏览型号MEGA128CAN的Datasheet PDF文件第180页浏览型号MEGA128CAN的Datasheet PDF文件第181页  
AT90CAN128  
The following simple USART0 initialization code examples show one assembly and one  
C function that are equal in functionality. The examples assume asynchronous opera-  
tion 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)  
USART0_Init:  
; Set baud rate  
sts  
sts  
UBRR0H, r17  
UBRR0L, r16  
; Set frame format: 8data, no parity & 2 stop bits  
ldi  
sts  
r16, (0<<UMSEL0)|(0<<UPM0)|(1<<USBS0)|(3<<UCSZ0)  
UCSR0C, r16  
; Enable receiver and transmitter  
ldi  
sts  
ret  
r16, (1<<RXEN0)|(1<<TXEN0)  
UCSR0B, r16  
C Code Example(1)  
void USART0_Init (unsigned int baud )  
{
/* Set baud rate */  
UBRR0H = (unsigned char) (baud>>8);  
UBRR0L = (unsigned char) baud;  
/* Set frame format: 8data, no parity & 2 stop bits */  
UCSR0C = (0<<UMSEL0) | (0<<UPM0) | (1<<USBS0) | (3<<UCSZ0);  
/* Enable receiver and transmitter */  
UCSR0B = (1<<RXEN0) | (1<<TXEN0);  
}
Note:  
1. The example code assumes that the part specific header file is included.  
More advanced initialization routines can be made that include frame format as parame-  
ters, disable interrupts and so on. However, many applications use a fixed setting of the  
baud and control registers, and for these types of applications the initialization code can  
be placed directly in the main routine, or be combined with initialization code for other  
I/O modules.  
177  
4250E–CAN–12/04  
 复制成功!