一、例程一:外部中断执行函数

cpp
#include<stc15.h>
void main(void)
{
P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
IT0=0;//设置外部中断0;上升沿下降沿均可
//IT0=1;//设置外部中断0;仅下降沿
EX0=1;//允许中断0申请中断
EA = 1;//打开CPU总中断
while(1);
}
void EXINT0(void) interrupt 0
{
P05 = !P05;
}

按下S5