按照例程修改的程序,可是例程能实现的功能,我自己接一个开关(开关一端接地,另一端接GPIO),就无法实现中断的功能。请各位指出我的错误,谢谢。#define DELAY (CPU_RATE/1000*6*510) //Qual period at 6 samplesvoid main(void)
{ InitSysCtrl();
// InitGpio(); // Skipped for this example
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.XINT3_INT = &xint3_isr;
EDIS;
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER12.bit.INTx1 = 1;
IER |= M_INT12;
EINT;
EALLOW;
GpioDataRegs.GPASET.bit.GPIO31 = 1;
GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 0; // GPIO
GpioCtrlRegs.GPADIR.bit.GPIO31 = 1; // output
EDIS;
EALLOW;
GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 0; // GPIO
GpioCtrlRegs.GPBDIR.bit.GPIO33 = 0; // input
GpioCtrlRegs.GPBQSEL1.bit.GPIO33 = 0;
EDIS;
GPIO_SetupXINT3Gpio(33);
XintRegs.XINT3CR.bit.POLARITY = 0; // Falling edge interrupt
XintRegs.XINT3CR.bit.ENABLE = 1; // Enable XINT3
for(;;)
{
}
}
interrupt void xint3_isr(void)
{
GpioDataRegs.GPATOGGLE.bit.GPIO31 = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP12;
}
|