void Timer0() interrupt 1
{
static u16 i;
TH0=0XFF; //给定时器赋初值,定时250Us
TL0=0X06;
if(i>=24000)
{
i++; //继续计时
if(i>=60000)
{
i = 60001; //给i赋值,防止溢出变0
if() //15s后判断P2.1输入
{
LED=~LED; //高电平脉冲保持
}else{
LED = 0; //低电平脉冲停止
}
}else{
LED=~LED; //6-15s,脉冲保持
}
}else{
i++;
if(i<=12000)
{
led=0;
}
if(i>12000&&i<24000)
{
led=1;
}
}
}
|