📄 interrupt.c
字号:
#include "Head.h"
extern uchar searchOK;
extern uchar Command[];
unsigned int TimeCNT,timer0,temp_1820=1,Button_02;//
uchar TimeBT;
bit psw; //pass word OK?
void EXintt0(void) interrupt 0 using 1
{ Alarm=0;
if(IN1) Alarm=1;
if(IN2) Alarm=2;
if(IN3) Alarm=3;
if(IN4) Alarm=4;
}
void time0(void) interrupt 1 using 2
{ TR0=0;
A0_ISD=0; //Sound quick search stop
searchOK=1; // set searchok flag
}
void signal_input(void) interrupt 2 using 2
{ unsigned char data temp;
static uchar counter,i=0;
//------------------------------------------------------------
temp=Read_80status();
if(HANDUP==1) //ring checking
{
if(timer0==1) timer0=1;
if(timer0>1200) {timer0=0; counter=0;}
if(timer0>75) counter++; //原值150
timer0=1;
if(counter==1)
{Inputcounter=0;
counter=0;
HANDUP=0;
timer0=1; //input watch dog(about 30s)
SoundEn=1;
}
}
else//---------------------------------------
{ //funtion
if((temp&0x02)==0x02 )
{temp=Read_80Data();
if(musicstate<9) musicstate=10;
timer0=2000; // Input watch dog/
//SoundEn=0;
if(AlarmHappen==1) {SoundEn=1; AlarmHappen=0;return;}
temp=temp & 0x0f;
if(GetPSW==1 && InputEn) //pass
{switch(InputLen)
{case 1:
if(temp==13) timer0=10000;
else{Funtion=temp;break;} // funtion select
case 2: // chanle control
if(i==0)
if(temp==3 || temp==13){Funtion=21;break;} // # ?
InputBuff[i++]=temp;
if(i==2)
{if(temp==3 || temp==13){ Funtion=20;break;} // No.+#
else {Funtion=23;break;} //input error
}
return;
case 3:
if(i==0 && temp==3){Funtion=21;break;} // # ?
InputBuff[i++]=temp;
if(i>2)
{if(temp==3 || temp==13){ Funtion=26;break;} // temperature.+#
else {Funtion=23;break;} //input error
}
return;
case 6: // change psw
InputBuff[i++]=temp;
//if(i<6 && temp==3){Funtion=21;break;}
if(i==6){Funtion=22;break;}
if(temp==3 || temp==13){Funtion=21;break;} //input Err
return;
case 11: //phone number
InputBuff[i++]=temp;
if(i<3 && temp==3) {Funtion=21;break;} //input Err
if(i>=13 || temp==3){Funtion=24;break;}
if(temp==13){Funtion=21;break;} //input Err
return;
}
InputEn=0;i=0;
return;
}
else //pass word input
if(InputEn==1)
{
InputBuff[i++]=temp; // psw input
if(i>12) {InputEn=0;InputErr=1;i=0;return;}
if(temp==0x03 )
{
if(i!=(InputLen+1)) InputErr=1;
else
{InputDone=1;
InputBuff[i-1]=0xff;
}
InputEn=0;
i=0;
}
}
}
}
}
void time1(void) interrupt 3 using 3//about 8ms
{ TH1=225; TL1=0;
if(temp_1820>0 && temp_1820<500)temp_1820++;//1820delay
if(Button_02>0 && Button_02<1000) Button_02++;//Button_02 delay
if(TimeCNT>0 && TimeCNT<2000) TimeCNT++; //8880 delay
if(TimeBT>0) TimeBT++; //button chcke
if(timer0>0)timer0++; //input signal check (watch dog/auto handdown)
if(timer0>10000)
{ HANDUP=1; timer0=9999;
GetPSW=0;InputLen=6;
LINE=1;
Funtion=0;
InputDone=0;
InputErr=0;
if(musicstate<9) musicstate=10; // stop sound
Sound[0]=15;
Sound[1]=29;
Sound[2]=27;
Sound[3]=0xff;
} //超时 挂机
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -