试了一下,刚开始以为是楼主没处理发送中断。。结果不是 啊,好奇怪。
#include "ML51.h"
unsigned char c;
void UART0_ISR(void) interrupt 4
{
if((SCON&SET_BIT0)==SET_BIT0)
{
c = SBUF;
SBUF = c;
clr_SCON_RI;
}
else if((SCON&SET_BIT1)==SET_BIT1)
{
clr_SCON_TI;
P03 ^= 1;
}
}
void main (void)
{
//LED端口初始化为数字输出推挽模式
MFP_P03_GPIO;
P03_PUSHPULL_MODE;
/**
For UART0 P0.5 asTXD output setting
* include uart.c in Common Setting for UART0
*/
MFP_P31_UART0_TXD; /* set P3.1 and P3.0 as Quasi mode for UART0 trasnfer */
MFP_P30_UART0_RXD;
P31_QUASI_MODE;
P30_QUASI_MODE;
UART_Open(24000000,UART0_Timer1,115200); // Open UART0 use timer1 as baudrate generate and baud rate = 115200
//启用串口0中断,并开启全局中断
UART_Interrupt_Enable(UART0,Enable);
ENABLE_GLOBAL_INTERRUPT;
while(1)
{
}
}
|