我用了DSP28335的五个外部中断,初步测试都正常,但是当我在while(1)中加入数码管显示程序后XINT1和XINT2就不好使了,XINT1有时能触发有时不行,XINT2几乎都触发不了,数码管显示正常,我XINT1和XINT2是用按键开关触发的,请问这是为什么?该怎么解决呢?
下面是程序
while(1)
{
Show_Data();
}
__interrupt void xint1_isr(void)
{
GpioDataRegs.GPBCLEAR.all = 0x4; // GPIO34 is low
Xint1Count++;
GpioDataRegs.GPATOGGLE.bit.GPIO31 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO30 = 1;
if(ModeSelect == InternalMode)
ModeSelect = ExternalMode;
else
ModeSelect = InternalMode;
// Acknowledge this interrupt to get more from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
__interrupt void xint2_isr(void)
{
GpioDataRegs.GPBCLEAR.all = 0x4; // GPIO34 is low
Xint2Count++;
GpioDataRegs.GPATOGGLE.bit.GPIO29 = 1;
if(LockButton == OutputUnlock)
LockButton = OutputLock;
else
LockButton = OutputUnlock;
// Acknowledge this interrupt to get more from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
void Show_Data(void)
{
int i,j;
Uint16 tempV,tempF;
tempV = VoltageExp;
tempF = FrequencyExp/10;
for(i=7;i>=4;i--) //后四位依次扫描?
{
j = tempF%10;
HC595_IN(wei[i]); //先传位码
if(i==5)
HC595_IN(duan[j]&0xfe); //再传段码
else
HC595_IN(duan[j]); //再传段码
HC595_OUT();
tempF = tempF/10;
asm(" NOP");asm(" NOP");asm(" NOP");asm(" NOP");
}
for(i=3;i>=0;i--) //前四位依次扫描
{
j = tempV%10;
HC595_IN(wei[i]); //先传位码
HC595_IN(duan[j]); //再传段码
HC595_OUT();
tempV = tempV/10;
asm(" NOP");asm(" NOP");asm(" NOP");asm(" NOP");
}
} |