📄 uarst.c
字号:
/************************************************************/
/* 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++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -