uarst.c
上传用户:xulicw
上传日期:2014-06-22
资源大小:133k
文件大小:1k
- /************************************************************/
- /* UARST Code for M32L */
- /* By pasyong */
- /* 2006-4 */
- /* Base ICC6.31A */
- /************************************************************/
- #include <iom32v.h>
- #include <macros.h>
- #include <stdio.h>
- //UART0 initialize
- // desired baud rate: 9600
- // actual: baud rate:9600 (0.0%)
- // char size: 8 bit
- // parity: Disabled
- void uart0_init(void)
- {
- UCSRB = 0x00; //disable while setting baud rate
- UCSRA = 0x00;
- UCSRC = BIT(URSEL) | 0x06;
- UBRRL = 0x2F; //set baud rate lo
- UBRRH = 0x00; //set baud rate hi
- UCSRB = 0x18;
- }
- //串口输出字符串
- void Puts( unsigned char *s)
- {
- while (*s)
- {
- putchar(*s);
- s++;
- }
- }