haolaishi 发表于 2014-4-7 22:24 
看看你的程序。。。
void UART_TEST_HANDLE()
{
uint8_t u8InChar=0xFF;
uint32_t u32IntSts= UART->ISR;
if(u32IntSts & UART_ISR_RDA_INT_Msk)
{
/* Get all the input characters */
while(UART_IS_RX_READY(UART))
{
/* Get the character from UART Buffer */
u8InChar = UART_READ(UART); /* Rx trigger level is 1 byte*/
if(u8InChar == '0')
{
g_bWait = FALSE;
}
/* Check if buffer full */
if(g_u32comRbytes < RXBUFSIZE)
{
/* Enqueue the character */
g_u8RecData[g_u32comRtail] = u8InChar;
g_u32comRtail = (g_u32comRtail == (RXBUFSIZE-1)) ? 0 : (g_u32comRtail+1);
g_u32comRbytes++;
}
}
}
uint16_t tmp;
tmp = g_u32comRtail;
if(g_u32comRhead != tmp)
{
u8InChar = g_u8RecData[g_u32comRhead];
UART_WRITE(UART,u8InChar);
、、有个等待发送完成吧
g_u32comRhead = (g_u32comRhead == (RXBUFSIZE-1)) ? 0 : (g_u32comRhead+1);
g_u32comRbytes--;
}
}
}
|