uarst.c
来自「5个按键控制+SD卡+MP3程序+MP3电路图」· C语言 代码 · 共 30 行
C
30 行
/************************************************************/
UARST Code for M32L
/************************************************************/
#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 + =
减小字号Ctrl + -
显示快捷键?