interrupt void ScibRxFifoIsr(void)
{
while(ScibRegs.SCIFFRX.bit.RXFFST!=1) { }
rx_data[rx_count]=ScibRegs.SCIRXBUF.all;
rx_count++;
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1;
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1;
PieCtrlRegs.PIEACK.bit.ACK9 = 1;
}
上述的串口接收中断子程序,运行中可以进入中断程序,但是当我发送123456789数据时,接收数组rx_data收到的却是49、50、51、52、53、54、55、56、57这样的数,检查波特率设置没有问题。另外,我的串口初始化如下:
void Scib_Fifo_Init() //SCI寄存器初始化
{
ScibRegs.SCICCR.all =0x0007; ScibRegs.SCICTL1.all =0x0003; ScibRegs.SCICTL2.bit.TXINTENA =1;
ScibRegs.SCICTL2.bit.RXBKINTENA =1;
ScibRegs.SCIHBAUD = 0x0001;
ScibRegs.SCILBAUD = 0x00E7;
ScibRegs.SCICCR.bit.LOOPBKENA =0;
ScibRegs.SCIFFTX.all=0xC028;
ScibRegs.SCIFFRX.all=0x0021;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023;
ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
烦请高手帮找找问题,非常感谢!
Haiton Chen:
回复 rui fu Li:
你好,我想问你这个程序的发送中断时怎么样的?是如何触发的?