📄 uart.c
字号:
/*------------------------------------------------------------
File Name: uart.c
Auther: Samuel
Revision: R1
History: R1 Jul.05, 2007 Creation
------------------------------------------------------------*/
#include "common.h"
#include "uart.h"
void uart_init(void)
{
//UART0, mode:1, baud:115200(22.1184MHz), 8bit
PCON |= 0x80; // SMOD=1 (HW_UART uses Timer 1 overflow
// with no divide down).
TMOD = 0x20; // Configure Timer 1 for use by HW_UART
CKCON |= 0x10; // Timer 1 derived from SYSCLK
TH1 = 0xF4; // Timer 1 initial value
TL1 = 0xF4; // Timer 1 reload value
TR1 = 1; // Start Timer 1
RI=0; // Clear HW_UART receive and transmit
TI=0; // complete indicators.
SCON = 0x50; // Configure HW_UART for mode 1, receiver enabled.
SBUF=0x00;// NULL: make the first TI=1
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -