文章目录
- 前言
前言
#include <reg52.h>
#include <intrins.h>sbit key_s2=P3^0;
sbit flag=P3^7;void delay(unsigned int z){unsigned int x,y;for(x=z;x>0;x--)for(y=114;y>0;y--);
}void int_init(){EA=1;EX1=1;IT1=1;}void main(){int_init();while(1){if (key_s2 == 0){delay(20);if(key_s2 ==0){flag =1;flag =0;while(!key_s2);}}}}void int1() interrupt 2
{P1=~P1;
}