实验二 报警与流水灯控制
#include"reg51.h"
#include"intrins.h"
sbit P3_7=P3^7;
sbit P3_2=P3^2;
void dely() //using 0 //延迟n秒
//void dely(unsigned int t) //using 0 //延迟n秒
{
unsigned int i,j;
for(i=0;i<4;i++)
for(j=0;j<50000;j++);//0.01s
}
void int1_warning() interrupt 0 //using 0
{
unsigned int i;
for(i=0;i<3;i++)
{
P3_7=1;
dely();
P3_7=0;
}
}
void main()
{
unsigned char a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned int i,j,LED;
EA=1;//CPU中断开
EX0=1;//INT0中断允许
IT0=0;//中断触发