#include "DSP281x_Device.h"
#include "DSP281x_Examples.h"
//#define SCI_IO 0x0030
void IO_function(void);
void Scib_init(void);
void Scib_xmit(int a);
interrupt void scibrxfifoisr(void);
Uint16 receivedchar=0;
void main(void)
{
InitSysCtrl();
IO_function();
DINT;
InitPieCtrl();
IER=0x0000;
IFR=0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.RXBINT=&scibrxfifoisr;
EDIS;
PieCtrlRegs.PIECRTL.bit.ENPIE=1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER=0x101;
EINT;
ERTM;
Scib_init();
for(;;){}
}
void IO_function(void)
{
EALLOW;
//GpioMuxRegs.GPGMUX.all=SCI_IO;
GpioMuxRegs.GPGMUX.bit.SCITXDB_GPIOG4=1;
GpioMuxRegs.GPGMUX.bit.SCIRXDB_GPIOG5=1;
EDIS;
}
void Scib_xmit(int a)
{
ScibRegs.SCITXBUF=(a&0xff);
while(ScibRegs.SCICTL2.bit.TXRDY!=1){};
}
void Scib_init(void)
{
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x2021;
ScibRegs.SCIFFCT.all=0x0;
ScibRegs.SCICCR.all =0x0007;
ScibRegs.SCICTL1.all =0x0003;
ScibRegs.SCICTL2.all =0x0003;
ScibRegs.SCIHBAUD =0x0001;
ScibRegs.SCILBAUD =0x00E7;
ScibRegs.SCICTL1.all =0x0023;
}
interrupt void scibrxfifoisr(void)
{
receivedchar=ScibRegs.SCIRXBUF.all;
receivedchar&=0xff;
Scib_xmit(receivedchar);
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1;
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1;
PieCtrlRegs.PIEACK.all|=0x100;
}
源程序如上,请高手解答!
当我在串口小助手中给dsp发十六进制数据02时,按照程序应该会进入中断,然后在中断函数中给串口小助手回应数据02.为什么没有?是没有进入中断吗?程序编译通过。附件中是寄存器的截图! |