uart.c
来自「AVR平台下的CanOpen协议桟源码包括应用」· C语言 代码 · 共 26 行
C
26 行
/* ------------------------------------------------------------------------
File : uart.c
Descr : Initialisation routine for the AVR's onchip UART.
History: 11APR.00; Henk B&B; Created.
--------------------------------------------------------------------------- */
#include "general.h"
/* ------------------------------------------------------------------------ */
void uart_init( BYTE baud )
{
/* Set the Baud Rate Register */
UBRR0L = baud;
/* Set the UART Control Register: enable receive and send */
UCSR0B = BIT(RXEN0) | BIT(TXEN0);
/* Enable interrupts */
/*UCSR0B |= BIT(RXCIE0) | BIT(TXCIE0);*/
}
/* ------------------------------------------------------------------------ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?