本帖最后由 MapleSugar 于 2017-11-23 14:23 编辑
RXBUF中有数据,但是进不去中断,怎么办?求助各位大神
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
// Prototype statements for functions found within this file.
void scib_loopback_init(void);
void scib_fifo_init(void);
void scib_xmit(int a);
void configGPIO(void);
__interrupt void SCIRXINTb_ISR(void);
__interrupt void cpu_timer0_isr(void);
// Global counts used in this example
Uint16 LoopCount=0;
Uint16 ErrorCount;
Uint16 sci_count;
Uint16 ReceiveChar;
Uint16 Char;
unsigned char Navdata[85];
void main(void)
{
InitSysCtrl();
configGPIO();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.TINT0 = &cpu_timer0_isr;
PieVectTable.SCIRXINTB= &SCIRXINTb_ISR;
EDIS;
InitScibGpio();
scib_fifo_init(); // Initialize the SCI FIFO
scib_loopback_init(); // Initalize SCI for digital loop back
InitCpuTimers();
ConfigCpuTimer(&CpuTimer0,90,1000000);
CpuTimer0Regs.TCR.all = 0x4000;
IER = 0x101; // Enable CPU INT
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
PieCtrlRegs.PIEIER9.bit.INTx3 = 1; // PIE Group 9, INT3 Receive Navigation information
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
for(;;)
{
}
}
void scib_loopback_init()
{
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;
ScibRegs.SCIHBAUD =64>>8;
ScibRegs.SCILBAUD =64 & 0x00FF;//38400波特率
ScibRegs.SCICCR.bit.LOOPBKENA =0; // Enable loop back
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
}
void scib_xmit(int a)
{
ScibRegs.SCITXBUF=a;
}
void scib_fifo_init()
{
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x2044;
ScibRegs.SCIFFCT.all=0x0;
}
void configGPIO(void)
{
EALLOW;
GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0; //配置为通用I/O口
GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0;
GpioCtrlRegs.GPADIR.bit.GPIO20 = 1; //作为输出I/O
GpioCtrlRegs.GPADIR.bit.GPIO20 = 1;
GpioDataRegs.GPADAT.bit.GPIO20 = 0;
GpioDataRegs.GPADAT.bit.GPIO21 = 1;
EDIS;
}
__interrupt void SCIRXINTb_ISR(void) // SCI-B-RX Receive Navigation
{
int i;
for (i=0;i<16;i++)
Navdata = ScibRegs.SCIRXBUF.all;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}
interrupt void cpu_timer0_isr(void)
{
ErrorCount++;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
|