interrupt void SCITXINTA_ISR(void) // SCI-A
{
// Insert ISR Code here
Sci_sendTimer1++;
SciaRegs.SCIFFTX.bit.TXFFINTCLR = 1; // Clear SCI Interrupt flag
// To receive more interrupts from this PIE group, acknowledge this interrupt
PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}
串口初始化函数:
void InitSci(void)
{
// Initialize SCI-A:
SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all = 0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
// Baud config 38400bps
SciaRegs.SCIHBAUD = 0x0000;
SciaRegs.SCILBAUD = SCI_PRD;
// FIFO configure enable FIFO
SciaRegs.SCIFFTX.all = 0xC020;
SciaRegs.SCIFFRX.all = 0x0021;
SciaRegs.SCIFFCT.all = 0x00;
SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset
SciaRegs.SCIFFTX.bit.TXFIFOXRESET = 1;
SciaRegs.SCIFFRX.bit.RXFIFORESET = 1;
}
这个是基于eeworld版主的例程上改的。
下面这个例子基于controlSUITE的例程
测试发现,例程:scia_loopback_interrupts
C:\ti\controlSUITE\development_kits\C2000_LaunchPad\f2802x_examples\scia_loopback_interrupts
关掉loopback模式后,发送中断函数还是不停在调用,这就很奇怪了??不发数据,为啥FIFO发中断会不停触发,大家可以试一下
修改代码:
void scia_init()
屏蔽掉//SCI_enableLoopBack(mySci);
或改成:SCI_disableLoopBack(mySci); |