各位前辈,麻烦指点下。
我配置了P04号管脚,接通端子时,进入中断。现在进入了中断,但是之后不再执行main主程序while里面的代码了。求各位帮忙看下是哪里的问题。
代码如下:
sbit led = P1^3;
bit powerBool;
void main (void)
{
InitialUART0_Timer1(115200);
P13_Quasi_Mode;
PICON |= 0x40;
PIPEN |= 0x10;
set_EA; //开启总中断
set_EPI;
while(1){
if(powerBool ==0){
printf ("\n if--");
led = 1;
Timer0_Delay1ms(500);
led = 0;
Timer0_Delay1ms(500);
led = 1;
Timer0_Delay1ms(500);
led = 0;
}else{
printf ("\n else");
led = 1;
}
}
}
void PinInterrupt(void) interrupt 7 {
printf ("\n zhongduan++");
if(PIF==0x10){
PIF=0;//清除外部中断标志
if(powerBool==0){
printf ("\n zhongduan -- if --");
powerBool =1;
}else{
printf ("\n zhongduan --else--");
powerBool=0;
}
}
} |