单片机中断程序,求解释下下面 C代码,谢谢

int0_key() interrupt 0//中断程序
{
P0_4=!P0_4;
}
int1_key() interrupt 2//中断程序
{
count++;
if(count>0x0f)
count=0;
P2=led_mod[count];
}

int0_key() interrupt 0//中断程序
{
P0_4=!P0_4;//状态取反
}
int1_key() interrupt 2//中断程序
{
count++;
if(count>0x0f)//判断count值如果>15则count清零
//这个应该和你定义的led_mod[]数组大小有关
count=0;
P2=led_mod[count]; //根据count值将对应的led_mod[]数组值赋予P2口
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-11-20
int0_key() interrupt 0//中断程序
int1_key() interrupt 2//中断程序
是不是要改写为:
int0_key() //interrupt 0中断程序
int1_key() //interrupt 2中断程序

int0_key(),P0_4应为输出引脚,按要求输出方波;
int1_key()中,count为0~16的计数器,将计数结果输出到LED_mod数组(可能是用于LED显示用的)。
第2个回答  2012-11-20
定时中断0:LED灯P0.4以定时时间为周期闪烁;
定时中断2:调用led_mod[count]数组并将值赋给P0口。
第3个回答  2012-11-20
同意hycutnet的回答~
相似回答