中国建筑招聘2022整站关键词排名优化
一、例程一:外部中断执行函数
#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
#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