⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jf_act.c

📁 一款完整的家用电器程序,具有控制商用机的功能,应用广泛,有一定的参考价值
💻 C
📖 第 1 页 / 共 5 页
字号:
		{
			fault_state4 &=~b_fault_comp_guozai;	//清除压缩机过载故障
			fault_comp_guozai_times =0;	//压缩机过载故障出现次数=0
			comp_guozai_clear_time =0;	//压缩机过载清除的时间
		}
		else comp_guozai_clear_time++;	//累加压缩机过载清除的时间
	}		
 }
 //在20秒中计时加湿器停止间隔,加湿开时清为0,加湿关时计时
  	if ((PIND &b_humid)==0)   
  	 {//加湿器停止	
  	   	t_humid_stop++;  //20秒+1,加湿停止时间+1
  		if (t_humid_stop>=4320) t_humid_stop=4321;//加湿停止时间>24小时防止溢出
  		t_humid_run=0;	//加湿开时间清0   		
  	 }  	
  	else 
  	{//加湿器启动
  		t_humid_stop=0;	//加湿开时停止时间清0  		
  		if (t_humid_run>=250) t_humid_run=251;//加湿开时间>8小时防止溢出
  		else t_humid_run++;  //20秒+1,加湿开时间+1
  		flag  &=~b_humid_pkstart;	//加湿开时清除加湿停止时排空开始
  	}
 
  }

void fun_delaytime_1min(void) //在1min中定时程序 
{

}
void fun_set_default(void) //出厂设置值初始化
  {
	  mint_compstop_set=3;	//压缩机最小停机时间1~6分钟,出厂设置3分钟
	  mint_comprun_set=6;	//压缩机最小运行时间1~6分钟,出厂设置6分钟
	  t_comp_ondelay_set=9;	//压缩机延时启动时间/20,出厂设置180秒/20,分钟*3
	 t_fan_ondelay_set=5;	//送风机延时启动时间出厂设置5秒
	 t_fan_offdelay_set=9;	//送风机延时关时间出厂设置180秒/20,分钟*3
	 t_ofan_offdelay_set=5;	//冷凝风机延时5秒关
	 t_lppdelay_set=20;	//低压保护延时出厂设置20秒
	 imax10_set=50	;	//加湿器额定电流为5A
	 t_outpai_set=100;	//加湿器桶排水时间20~255秒,出厂设置100秒
	 int_THset=24;	//设定温度出厂设置24整数
	 dig_THset=0;	//24.0
	 RHset=50;	//设定湿度出厂设置50%整数
	 th_actual10=10;	//字节6温度精度Tm 0.5~5,出厂设置*10
	  rh_actual=5;	//湿度精度RHm2~10,出厂设置5
	  exghaust_TH_set=130;	//排气温度保护130度
	  rh_value_modify=0;	//
	  th_value_modify=0;	//
	  TH_lowlimit=15; //回风温度下限
	  TH_highlimit=30; //回风温度上限
	RH_lowlimit=20; //回风湿度下限
	RH_highlimit=80; //回风湿度上限
  	}  
 
/* 
当压缩机运行时间大于10秒,监测到对应低压控制器低压信号时,停对应压缩机。
并在显示屏上显示对应故障提示,发出报警声。
停3分钟后,若低压控制器已经自动复位,则压缩机自动恢复运行,同时取消故障提示和报警声。
若连续3次出现上述保护,则不能自动恢复运行。并显示对应故障提示,发出报警声,
故障灯亮。选故障复位或手动关机掉电后,消除故障信号。或按手持器上复位键时,清除所有故障信号。 
*/
  void fun_lpp(void)	//压缩机低压开关保护
  {
	fun_comp_off_fault();  //故障时关压缩机立即停止 
	t_lppdelay=0;  //清除压缩机开机后计时低压保护时间
	fault_state4 |=b_fault_lpp;
	fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
	fault_lpp_times++; //检查是否连续3次出现,是则判断低压保护故障
 	if (fault_lpp_times <3) //未到3次时启动3分钟延时
	   {
		start_state2 |=b_lpp_delay2start; //低压保护时启动计时3分钟
		t_lpp_delaytime=0; //计时3分钟
		lpp_clear_time =0;	//低压保护恢复的时间=0
		run_state2 &=~b_lpp_delay2; //3分钟到标志清0
		//此时打开能量调节电磁阀,4分钟后关闭。
		PORTG |=b_yv_adjust;	//PG1调节阀YV-ADJUST
		t_yvadjust_delaytime=0; 
		start_state2 |=b_yvadjust_delaystart; //能量调节电磁阀启动计时4分钟
		run_state2 &=~b_yvadjust_delay;	//置能量调节电磁阀4分钟标志0
	   }
 } 
void fun_fault_detect(void) //故障检测程序
{
 //连续3S检查到高压开关断开,置HPP保护
 if ((fault_state4 &b_fault_hpp)==0)
 { 
   //  if (PINA &b_hpp)  //200803老机组的高压保护为闭合时正常,断开时故障
   if ((PINA &b_hpp)==0) //20070705新装的机组上压力部件为高压保护为断开正常,闭合时有保护为0
      {
    	if (fault_hpp_times >=3)  
    	 {
    		fault_state4 |=b_fault_hpp;
	 	    fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
    	  }
    	else  fault_hpp_times++; 
    	}
    else fault_hpp_times =0;
  }
 //连续3S检查到送风机断开,置过载保护
  if ((fault_state3 &b_fault_pfan)==0)
 { 
 	//if (PINA &b_pfan) 
 	if ((PINA &b_pfan)==0) //20080620
      {
    	if (fault_pfan_times >=3)  
    		{
    			fault_state3 |=b_fault_pfan;
	 	       fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
    		  }
    	else fault_pfan_times++;	  
      }
    else fault_pfan_times =0;
  }
// 连续3S检查到逆相保护器断开,相序故障
  if ((fault_state5 &b_fault_nixiang)==0)
  {
  	//if (PINA &b_nixiang) 
  	if ((PINA &b_nixiang)==0)	//20080620
    	{
    	 if (fault_nixiang_times >=3) 
    	  {
    		fault_state5 |=b_fault_nixiang;
	 	    fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
    	  }
    	else fault_nixiang_times++;
    	}
    else fault_nixiang_times =0;
    }
// 连续3S检查到限温器断开,电加热故障fault_overheat
  if ((fault_state3 &b_fault_overheat1)==0)
  {
  	//	if (PINC &b_overheat1) 
  		if ((PINC &b_overheat1)==0)	//20080620
    	  {
    		if (fault_overheat1_times >=3)  
    		{
    			fault_state3 |=b_fault_overheat1;
	 	        fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
    		}
    		else fault_overheat1_times++;
    	  }
    	else fault_overheat1_times =0;
    }
// 连续3S检查到限温器断开,电加热故障fault_overheat2
  if ((fault_state3 &b_fault_overheat2)==0)
  {
	//if (PINC &b_overheat2) 
	if ((PINC &b_overheat2)==0)	//20080620
    	{
    		if (fault_overheat2_times >=3)  
    		{
    			fault_state3 |=b_fault_overheat2;
	 	    fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
    		}
    		else fault_overheat2_times++;
    	}
    else fault_overheat2_times =0;
  }
//20071128取消电加热带故障  
// 压缩机关时连续30S检查到电加热带断开,电加热带故障b_fault_heatdai
     if ((fault_state4 &b_fault_heatdai)==0)	
      {
       	if ((PINB &b_comp)==0)  
 	   {
    	if ((PINC &b_p_heatcomp)==0)	//电加热带断开无电时PINC为0
    	  {
    //老机组无电加热带故障输入		fault_heatdai_times++;
    		fault_heatdai_times++;//新机组有电加热带故障输入	
    		if (fault_heatdai_times >=30)  
    		  {
    			//20071128 fault_state4 |=b_fault_heatdai;
    			//fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
    		  }
    	  }
    	else fault_heatdai_times =0;	//电加热带有电时清除故障计数。
      }
	}  
	if (PINB &b_comp)
	{// 压缩机ON连续3S检查到过流保护器断开,压缩机过载故障fault_comp_guozai
	//  if (PINC &b_comp_guozai) //过流保护时
	if ((PINC &b_comp_guozai)==0)	//20080620 //过流保护时
		{
		  if (fault_comp_guozai_s >=3)	
		    {
		    fault_state4 |=b_fault_comp_guozai;
		    fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
		    fun_comp_off_fault();  //故障时关压缩机
		    fault_comp_guozai_times++;  //压缩机过载故障出现次数+1
		    if (fault_comp_guozai_times <3)  //连续3次出现,则判断压缩机过载故障,未到3次时关压缩机,启动3分钟延时
		      {
			    fault_comp_guozai_s=0; //清除压缩机过载故障时间计数
				start_state2 |=b_comp_gz_delaystart; //压缩机过载时启动计时3分钟
				t_comp_gz_delaytime=0; //
				comp_guozai_clear_time =0;	//开始过载恢复的计时
			  }
			}
		else  fault_comp_guozai_s++;
	    }
	  else fault_comp_guozai_s =0;//过流保护恢复时计时清0
	} 
     	  
/*20080201当压缩机运行连续30秒监测到压缩机排气温度断路or开路,停对应压缩机,故障提示。
停3分钟后若排气温度自动恢复,压缩机重新启动,同时取消故障。
若连续3次出现上述保护,则不能自动恢复运行。并显示对应故障,选故障复位或关机消除故障 */
//排气感温包故障 
	if (PINB &b_comp)   //压缩机启动
	   {
	    if ((exghaust_AD>=250) ||(exghaust_AD<=5))	//室外排气温度AD值
	      {
	    	if (fault_exTH0_time >=30) //排气感温包故障时间超过30秒
	    	   {
	    		fault_state4 |=b_fault_exTH0;
	    		fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
	    		fun_comp_off_fault();  //故障时关压缩机
	    	   	fault_exTH0_times++;  //排气感温包故障故障出现次数+1
	    	   if (fault_exTH0_times <3) //连续3次出现,则判断排气感温包故障故障,未到3次时关压缩机,启动3分钟延时
	    		   {
	    		   	fault_exTH0_time=0; //清除排气感温包故障故障时间计数
		  	   	   	start_state2 |=b_exTH0_delaystart; //排气感温包故障时启动计时3分钟
					t_exTH0_delaytime=0; //
					exTH0_clear_time =0;	//排气温度保护恢复时间=0
			   	   }
	    	     }
	    	else  fault_exTH0_time++;   //未到30秒则继续计时  
	      } 
       else  //排气温度正常
      	   {
      	   	fault_exTH0_time=0; //清除排气温度过高故障时间计数
	      	if ((fault_exTH0_times>0) &&(fault_exTH0_times<3))//排气感温包故障次数<=3
	      	   {
	      	   	if (exTH0_clear_time >900)	//超过15分钟正常运行时清排气感温包故障及次数
	      	   	{	
	      	     	fault_exTH0_times=0; //清排气感温包故障次数
	      	      	fault_state4 &=~b_fault_exTH0;	//清排气感温包故障
	      	      	exTH0_clear_time =0;	//排气温度保护恢复时间=0
	      	     }
	      	    else exTH0_clear_time++;	//累加排气感温包故障清除的时间
      	     } 
      	} 
    }  
    
/*当连续30秒监测到压缩机排气温度高于设定值,停对应压缩机,故障提示。
停3分钟后若排气温度小于90℃,压缩机重新启动,同时取消故障。
若连续3次出现上述保护,则不能自动恢复运行。并显示对应故障,选故障复位或关机消除故障 */
//排气温度过高故障 
	if (PINB &b_comp)   //压缩机启动
	   {
	    if ((exghaust_TH>=exghaust_TH_set)&&(exghaust_TH!=199))	//室外排气温度的值过高
	      {
	    	if (fault_exTHh_time >=30) //排气温度过高故障时间超过30秒
	    	   {
	    		fault_state4 |=b_fault_exTHh;
	    		fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序
	    		fun_comp_off_fault();  //故障时关压缩机
	    	   	fault_exh_times++;  //排气温度过高故障出现次数+1
	    	   if (fault_exh_times <3) //连续3次出现,则判断排气温度过高故障,未到3次时关压缩机,启动3分钟延时
	    		   {
	    		   	fault_exTHh_time=0; //清除排气温度过高故障时间计数
		  	   	   	start_state2 |=b_exTHh_delaystart; //排气温度过高时启动计时3分钟
					t_exh_delaytime=0; //
					exh_clear_time =0;	//排气温度保护恢复时间=0
			   	   }
	    	     }
	    	else  fault_exTHh_time++;   //未到30秒则继续计时  
	      } 
       else  //排气温度正常
      	   {
      	   	fault_exTHh_time=0; //清除排气温度过高故障时间计数
	      	if ((fault_exh_times>0) &&(fault_exh_times<3))//排气温度过高故障次数<=3
	      	   {
	      	   	if (exh_clear_time >900)	//超过15分钟正常运行时清排气温度过高故障及次数
	      	   	{	
	      	     	fault_exh_times=0; //清排气温度过高次数
	      	      	fault_state4 &=~b_fault_exTHh;	//清排气温度过高故障
	      	      	exh_clear_time =0;	//排气温度保护恢复时间=0
	      	     }
	      	    else exh_clear_time++;	//累加排气温度过高清除的时间
      	     } 
      	} 
    }  
        
  //内风机开10秒后,连续3秒监测到风压开关动作时,停止内风机,停止整机,监测到过滤器堵塞
  if (PING & b_fan)  //内风机开
     {
	  if (t_fan_run >=10)  //内风机开10s
	   {  
		if ((fault_state5 &b_fault_pfilter)==0)
		 {
		 // if (PINC & b_pfilter)	 //过滤器堵塞故障
		 if ((PINC & b_pfilter)==0)	 //20080620过滤器堵塞故障
		      {	
		      	if (fault_pfilter_times>=3) 
		      	{
		      		fault_state5 |=b_fault_pfilter;  //过滤器堵塞	
	 	    		fun_fault_beep();	//20080201增加故障报警蜂鸣器子程序

⌨️ 快捷键说明

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