?? uart.c
字號:
/******************************************************************************/
//
// Name: BF532-based EZ-KIT UART Setup
//
/******************************************************************************
Purpose: The file sets up the UART port for serial port transfers.
The Baud rate is setup at 115.2kbps
where Baud rate = SCLK/(16*Divisor) and SCLK = 75.6 MHz
*********************************************************************************/
#include <cdefBF533.h>
void Init_UART(void)
{
/*****************************************************************************
* First of all, enable UART clock.
****************************************************************************/
*pUART_GCTL |= UCEN;
*pUART_LCR |= DLAB; // Reset the UART and enable access to DLL
*pUART_DLL = 0x0029; // Set the Baud rate to be 115.2kbps
// *pUART_DLL = 0x0052; // Set the Baud rate to be 57.6kbps
*pUART_DLH = 0;
*pUART_LCR = 0x0003; // 8-bit, no parity, 1 STOP bit
}
void UART_PUTC(char TXD)
{
// Make sure the Transmit Hold Reg is empty first
while ((*pUART_LSR & 0x0020) == 0);
*pUART_THR = (unsigned short) TXD;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -