/***********************************/
/* 报警子函数 */
/***********************************/
void alarm(char tm)
{
int i,j;
if (tm<4*ctm)
for(i=0;i<tm;i++)
for(j=0;j<200;j++)
{
P1_3=!P1_3;
error_display(); //消警
if(P3_5==0)
{
time=ctm;
return;
}
}
else
{
IE=0x82;
TCON=0x10;
TMOD=0x01;
TH0=0xFF;
TL0=0x00;
i=0;
while(P3_5!=0)
{
Alarm_temp= Alarm_temp+1;
error_display();
i+=1;
if (i%10==0)
{
P1_4=! P1_4;
}
IE=0X00;
time=ctm;
}
}
void timer(void) interrupt 1 using 1 // 定时器0中断程序,用于报警
{
TH0=0xfe;
TL0=Alarm_temp;
P1_3=!P1_3;
}