我现在就想实现往SCITXBUF里面写一字节,然后数据立马发送出去,不需要触发发送中断。请问发送缓存FIFO里面应该怎么设置?
EALLOW;
// Init_Bauud
// Note: Clocks were turned on to the SCIB peripheral
// in the InitSysCtrl() function
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.all =0x0003;
ScibRegs.SCICTL2.bit.TXINTENA =1;
ScibRegs.SCICTL2.bit.RXBKINTENA =1;
#if (CPU_FRQ_150MHZ)
// ScibRegs.SCIHBAUD =0x0001; // 9600 baud @LSPCLK = 37.5MHz.
// ScibRegs.SCILBAUD =0x00E7;
ScibRegs.SCIHBAUD =0x0000; // 115200 baud @LSPCLK = 37.5MHz.
ScibRegs.SCILBAUD =0x0027;
#endif
#if (CPU_FRQ_100MHZ)
// ScibRegs.SCIHBAUD =0x0001; // 115200 baud @LSPCLK = 20MHz.
// ScibRegs.SCILBAUD =0x0044;
#endif
// ScibRegs.SCICCR.bit.LOOPBKENA =1; // Enable loop back
ScibRegs.SCIFFTX.all=0xE040;//
ScibRegs.SCIFFTX.bit.SCIFFENA = 0;//禁止FIFO功能
ScibRegs.SCIFFRX.all=0x002B;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
EDIS;
void Scib_SendChar(Uint8 msg)
{
while(!ScibRegs.SCICTL2.bit.TXRDY){}
ScibRegs.SCITXBUF=msg;
//while (ScibRegs.SCIFFTX.bit.TXFFST != 1) { }
}
如同上面,SCIFFENA = 0禁止FIFO功能,发送函数采用查询的方式发送,但是我这样连续发送一帧数据之后,数据总是会后面的跑到前面去了。例如我DSP里面向上位机发送34 35 36 37 38 39 40 42 43,但是上位机上面收到得却是42 43 34 35 36 37 38 39 40,42和43跑到前面去了,并且有时42和43会出错, 现在就想实现和STM32一样,发送一字节就是一字节,也不需要使能发送中断。请问FIFO应该怎么设置哦?