自己翻译了一下,不保证一定能实现你要的效果,大概程序是这样,不知道你引脚接的什么,所以只能用a,b,c,d,e代替
#include
#define uchar unsigned char
#define uint unsigned int
sbit a=P3^0;
sbit b=P3^1;
sbit c=P1^2;
sbit d=P1^0;
sbit e=P3^2;
uchar num=14;
void delay()
{
uint x,y;
for(x=110;x>0;x--)
for(y=100;y>0;y--);
}
void alarm()
{
c=1;
a=~a;
b=~b;
TMOD=0x01;
TL0=0xb0;
TH0=0x3c;
TR0=1;
if(TF0==1)
{
TL0=0xb0;
TH0=0x3c;
num--;
if(num==0)
{
num=14;
a=1;
b=0;
c=0;
}
}
}
void main()
{
IE=0x81;
IT0=1;
a=1;
b=0;
P1=0xff;
P2=0x00;
c=0;
while(1)
{
if(d==0)
{
delay();
if(d==0)
{
alarm();
}
}
}
}
void INT_0() interrupt 0
{
EX0=0;
if(e==0)
{
delay();
if(e==0)
{
a=1;
b=0;
c=0;
EX0=1;
if(d==0)
{
delay();
if(d==0)
{
alarm();
}
}
}
}
}