time_int.h

来自「单片机控制电子门 密码锁」· C头文件 代码 · 共 43 行

H
43
字号
/****************************************************************
T0中断处理函数   				中断一次50ms,time=60*50=3000ms
	输入参数:待定							 time=100*50=5000ms
	输出参数:待定
*****************************************************************/
void time0() interrupt 1				
{  
	TF0=0;
    TH0=(65536-50000)/256;
    TL0=(65536-50000)%256;
    count++;
	flag3=1;
	if(count==100)
	{
		flag3=0;
		count=0;
		TR0=0;
	}
}
/****************************************************************
T1中断处理函数   				中断一次50ms,time=60*50=3000ms
	输入参数:待定							 time=100*50=5000ms
	输出参数:待定
*****************************************************************/
void time1() interrupt 3				
{  
	TF1=0;
    TH1=(65536-50000)/256;
    TL1=(65536-50000)%256;
    count++;
	if(!(count%10))
		yes=~yes;
	if(count==20)
		lock_flag=1;//开启键盘		
	if(count==60)
	{
		ok=1;
		yes=1;
		newpw_flag=0;//超时不允许修改密码
		TR1=0;//关闭计数
		count=0;	
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?