/* Determine if a fractional divider is needed to get closer to the baud rate */
brfa = (((busclk_k*2000)/baud) - (sbr * 32));
//brfa =0;
UART0_C4 = (unsigned char)(brfa & 0x001F);
/* Configure the UART for 8-bit mode, no parity */
UART0_C1 = 0;
/* Enable receiver and transmitter */
UART0_C2 |= (UART_C2_TE_MASK | UART_C2_RE_MASK ); 作者: chiusir 时间: 2013-3-28 15:15
发送函数如下:
void uart0_putchar (unsigned char data)
{
/* Wait until space is available in the FIFO */
while(!(UART0_S1 & UART_S1_TDRE_MASK));
/* Send the character */
UART0_D = data;
}作者: 尕玍紿 时间: 2013-3-29 10:45