STC12C5A单片机串口2进不去中断,串口1正常通信!
void halUart2Init( void )
{
S2CON = 0x50; //MODE = 1; REN = 1;
BRT =0x70; //Auto reload rate;2400
AUXR &= 0xF7; //波特率不倍速
AUXR |= 0x14; //1T BRTR作为波特率发生器 S2SMOD=0
IPH2 = 0x01;
IP2 = 0x01; //串口2为最高优先级
AUXR1 &= 0x10; //RXD->P42;TXD->P4.3
halUart2ClearBuf();
IE2 = 0x01; //ES2=1 Enable UART2
EA=1;
}
void HalUartIsr2(void) interrupt 8 using 1
{
if(S2CON&S2RI)
{
// fafa(12);
HAL_LED_ON();
delay(10);
S2CON &= ~S2RI;//Clear receive Flag;
gTimeCnt.time11msCnt = 0;
gUart2RxData.recData = TRUE;
gUart2RxData.buf[gUart2RxData.index++] = S2BUF;
//halUart2SendOneData(12);
} |