Xint1.zip
(731.08 KB)
#include "inc/DSP28_Device.h"
#include "inc/DSP28_GlobalPrototypes.h"
unsigned int *Led = (unsigned int *)0x4100;
unsigned int ct;
void delay()
{
unsigned int i;
for(i=0;i<2000;i++);
}
interrupt void xint1_handler()
{
ct++;
if(ct%2)
*Led=0xff;
else
*Led=0x00;
delay();
PieCtrl.PIEACK.all=0xffff;
}
void main(void)
{
InitSysCtrl();
DINT;
InitPieCtrl();
InitPieVectTable();
EALLOW;
GpioMuxRegs.GPEMUX.bit.XINT1_XBIO_GPIOE0=1;
XIntruptRegs.XINT1CR.bit.ENABLE=1;
XIntruptRegs.XINT1CR.bit.POLARITY=0;
PieVectTable.XINT1=&xint1_handler;
PieCtrl.PIEIER1.bit.INTx4=1;
PieCtrl.PIECRTL.bit.ENPIE=1;
EDIS;
*Led=0xff;
delay();
*Led=0x00;
IER |= M_INT1;
EINT;
while(1);
}
外部中断1的操作与中断13的操作有所不一样,我们使用外部中断1的时候应该打开PIE寄存器,这样才能够使中断执行。
|