📄 jf_act._c
字号:
{
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 (fault_pfilter_times>=3)
{
fault_state5 |=b_fault_pfilter; //过滤器堵塞
fun_fault_beep(); //20080201增加故障报警蜂鸣器子程序
}
else fault_pfilter_times++;
}
else fault_pfilter_times=0;
}
NOP();
if ((fault_state5 &b_fault_lowfan)==0)
{
if (PINC & b_lowfan) //PC2风机低风压故障LOW-FAN
{
if (fault_low_fan_times>=3)
{
fault_state5 |=b_fault_lowfan; //风机低风压故障LOW-FAN
fun_fault_beep(); //20080201增加故障报警蜂鸣器子程序
}
else fault_low_fan_times++;
}
else fault_low_fan_times=0;
}
}
else t_fan_run++; //计时+1
}
else
{ t_fan_run=0;fault_low_fan_times=0;fault_pfilter_times=0;}
NOP();
if (b_fault_sht_times>=3)fault_state2 |=b_fault_sht; //3次后回风探头故障不能自动恢复
else if ((fault_state2 &b_fault_sht)==0)
{//SHT无应答时次数到达36时回风探头故障 3 分钟
// if (sht_fault_times >=sht_fault_time_std) //200802
if (sht_noread_time >=t_180s_10s) //180秒到快测10秒
{
fault_state2 |=b_fault_sht; //SHT 读写错误回风探头故障
fun_fault_beep(); //20080201增加故障报警蜂鸣器子程序
t_value=0;rh_value=0;t_value10=0;t_value10_20s=0;rh_value_20s=0;//20071225出错时置0
b_fault_sht_times++; //回风探头故障次数+1
sht_ok_times=0; //SHT读正确次数清0
t_b_fault_sht=0; //在20秒计时中定义SHT故障是否恢复
flag &=~b_sht_nofirst; //上电时或故障后第一次读SHT正确
}
else sht_noread_time+; //20080222改为未读到SHT的计时
if (sht_ok_times >=sht_ok_times_std) //快测时SHT读正确次数)
{//无故障时连续10分钟则清除次数
b_fault_sht_times=0;
}
else sht_ok_times++;
}
if (fault_tongxun_times>=3)fault_state2 |=b_fault_tongxun; //3次后通讯故障不能自动恢复
else if ((fault_state2 &b_fault_tongxun)==0)
{//正常下如连续60秒未正确收到通讯则置通讯故障,停止整机,应急时通讯故障不作用
//快测时通讯故障时间为10秒
if (rxd_nogood_time >=rxd_nogood_time_std)
{
fault_state2 |=b_fault_tongxun;
fault_tongxun_times++; //次数+1
fun_fault_beep(); //20080201增加故障报警蜂鸣器子程序
tongxun_ok_time=0; //通讯正常时间
t_b_fault_tongxun=0; //通讯故障时间
}
else rxd_nogood_time++; //通讯故障连续时间 ,在正确接收到显示板通讯时清0
if (tongxun_ok_time >=tongxun_ok_time_std)
{//无故障时连续10分钟则清除次数
fault_tongxun_times=0;
}
else tongxun_ok_time++;
}
}
void fun_fault_guanji(void) //故障停机立即关所有执行机构 关闭压缩机、电加热、加湿器,风机
{
PORTB &=~b_comp; //PB6压缩机COMPoff
PORTC &=~b_yv_dry;
PORTG &=~ b_yv_adjust; //关PG1调节阀YV-ADJUST
PORTG &=~b_ofan; //PG0冷凝风机OFAN关
PORTD &= ~b_heat_comp;
PORTD &= ~b_yv_comp;
PORTD &=~ b_humid; //PD0加湿HUMID关
NOP();
PORTD &=~ b_yv_in; //PD1进水阀YV-IN关
PORTD &=~ b_yv_out; //PD5排水阀YV-OUT关
PORTB &=~ b_heat1; //关电加热1
PORTB &=~ b_heat2; //关电加热2
PORTG &=~b_fan; //停止风机
}
void fun_guanji(void) //正常关机
{
PORTD &=~ b_humid; //PD0加湿HUMID关
NOP();
PORTD &=~ b_yv_in; //PD1进水阀YV-IN关
PORTD &=~ b_yv_out; //PD5排水阀YV-OUT关
PORTB &=~ b_heat1; //关电加热1
PORTB &=~ b_heat2; //关电加热2
PORTG &=~ b_yv_adjust; //关PG1调节阀YV-ADJUST
if (PINB &b_comp) fun_comp_off(); //关压缩机
else //关压缩机后再关外风机,最后延时180秒关内风机
{
if (PING &b_ofan) fun_ofandelayoff(); //冷凝风机等待延时关
else if (PING &b_fan) fun_fan_delay_off(); //内风机等待延时关
}
}
void fun_guanji_sht(void) //正常关机,风机保持原状
{
PORTD &=~ b_humid; //PD0加湿HUMID关
NOP();
PORTD &=~ b_yv_in; //PD1进水阀YV-IN关
PORTD &=~ b_yv_out; //PD5排水阀YV-OUT关
PORTB &=~ b_heat1; //关电加热1
PORTB &=~ b_heat2; //关电加热2
PORTG &=~ b_yv_adjust; //关PG1调节阀YV-ADJUST
if (PINB &b_comp) fun_comp_off(); //关压缩机
else //关压缩机后再关外风机,最后延时180秒关内风机
{
if (PING &b_ofan) fun_ofandelayoff(); //冷凝风机等待延时关
}
if (mode & b_kaiji) //开机
{
if ((mode&b_manual_on)==0) //自动on
{//自动开机时内风机开
if ((PING &b_fan)==0)fun_fan_delay_on(); //内风机关时等待内风机延时启动
}
else //手动
{//手动开机时如内风机请求开则开,否则为关
if (manual_act_ask &b_fan_onask)
{if ((PING &b_fan)==0)fun_fan_delay_on();} //内风机关时等待内风机延时启动
else if (PING &b_fan) fun_fan_delay_off(); //关机时内风机等待延时关
}
}
else if (PING &b_fan) fun_fan_delay_off(); //关机时内风机等待延时关
}
void fun_comp_off(void) //关压缩机
{ //压缩机最小运行时间到时关压缩机、除湿阀、调节阀,内风机及冷凝风机延时关
//20080201 if (mode & b_fast_test) run_state |= b_comp_run; //20071113快测时取消压缩机延时关;
if (run_state &b_comp_run) //压缩机最小运行时间计时到
{
PORTB &=~b_comp; // 关压缩机
PORTC &=~b_yv_dry; //b_yv_dry=0
PORTD &=~b_yv_comp; //PD7压缩机阀YV-COMP
if (PING &b_ofan) fun_ofandelayoff(); //冷凝风机等待延时关
}
}
void fun_comp_off_fault(void) //故障时关压缩机立即停止
{
PORTB &=~ b_comp; //压缩机off
PORTC &=~b_yv_dry; //b_yv_dry=0
PORTD &=~b_yv_comp; //PD7压缩机阀YV-COMP
if (PING &b_ofan) fun_ofandelayoff(); //冷凝风机等待延时关
}
//若电流小于0.6Iset进水阀开,关排水阀;
//若电流大于1.1Iset开排水阀,开进水阀;
//20080217若电流Iset<I≤1.1Iset时,如果排水阀开着,则进水阀跟排水阀维持原状态,如果排水阀关着,则关进水阀
//20080217若电流0.9Iset≤I≤Iset时,进水阀跟排水阀维持原状态。
//20080217若电流0.6Iset≤I<0.9Iset时,如果排水阀开着,则关闭排水阀跟进水阀。如果排水阀关着,则进水阀维持原状态(开着就保持开着,关着就保持关着);
void fun_humid_i_act(unsigned char imax10) //按电流大小来动作加湿器程序
{
float c1=0.6; //c1=0.9;
float c2=0.9; //
float c3=1.1; //
float imax_temp1,imax_temp2,imax_temp3;
imax_temp1 =c1*imax10; //Imax×0.6
imax_temp2 =c2*imax10; //Imax×0.9
imax_temp3 =c3*imax10; //Imax×1.1
if (i_humid10 <imax_temp1) //当I1<Ir*0.6时,YV1得电,加湿器进水
{//高水位无连续10秒才可以动作进水阀
if (t_highwater_ok>=10)PORTD |=b_yv_in; //手动进水开进水阀YV-IN开
else PORTD &=~b_yv_in; //PD1进水阀YV-IN关
PORTD &= ~b_yv_out; //PD5排水阀YV-OUT关
}
else if (i_humid10 >imax_temp3) //当I1>Iset*1.1时,YV2得电,加湿器排水
{//20080128改为若电流大于1.1Iset开排水阀(开进水阀)
if (t_highwater_ok>=10)PORTD |=b_yv_in; //20080128手动进水开进水阀YV-IN开
else PORTD &=~b_yv_in; //PD1进水阀YV-IN关
PORTD |= b_yv_out; //PD5排水阀YV-OUT得电
}
else if (i_humid10 >imax10)
{//若电流Iset<I≤1.1Iset时,如果排水阀开着,则进水阀跟排水阀维持原状态,如果排水阀关着,则关进水阀
if ((PIND &b_yv_out)==0)PORTD &= ~b_yv_in; //排水阀关时,加湿器停止进水
}
else if (i_humid10 <imax_temp2)
{//20080217若电流0.6Iset≤I<0.9Iset时,如果排水阀开着,则关闭排水阀跟进水阀。如果排水阀关着,则进水阀维持原状态(开着就保持开着,关着就保持关着);
if (PIND &b_yv_out)
{
PORTD &= ~ b_yv_out; //0.6Iset≤当I1<0.9Iset时,关排水电磁阀
PORTD &= ~b_yv_in; //PD1进水阀YV-IN关
}
}
}
void fun_humid_clean_low(void) //加湿小清洗
{//若加湿器停机时间小于5小时,则对加湿器进行小换水,加湿器跟进水阀同时上电,延时10秒打开排水阀,进行加湿器桶换水,
//10秒后关闭排水阀。此间(20秒)电流不做比较,20秒后进行电流对比。
PORTD |=b_humid; //加湿HUMID上电 //高水位无连续10秒才可以动作进水阀
if (t_highwater_ok>=10)PORTD |=b_yv_in; //手动进水开进水阀YV-IN开
else PORTD &=~b_yv_in; //PD1进水阀YV-IN关
t_humid_clean_start++; //加湿清洗计时清0
if (t_humid_clean_start>20) //
{
auto_state |=b_humid_clean_end; //加湿清洗结束
t_humid_clean_start=0;
PORTD &= ~ b_yv_out; //加湿清洗结束时,关排水电磁阀
}
else if (t_humid_clean_start>10)PORTD |= b_yv_out; //延时10秒打开排水阀YV-OUT
}
void fun_humid_clean_big(void) //加湿大清洗
{//判断加湿器停机时间,若超过5-24小时,则先打开排水阀,加湿器排水时间到后,打开进水阀,
//10秒后关闭排水阀,同时打开加湿器,进入电流对比流程。
unsigned char temp=t_outpai_set+10;
PORTD &=~b_humid; //PG4加湿HUMID关
t_humid_clean_start++; //加湿清洗计时清0
if (t_humid_clean_start>temp) //超过加湿器设定//排水时间+10秒时清洗结束
{
auto_state |=b_humid_clean_end; //加湿清洗结束
t_humid_clean_start=0;
PORTD &= ~ b_yv_out; //加湿清洗结束时,关排水电磁阀
t_humid_run=0; //清洗结束时清除连续开加湿时间
auto_state &=~b_humid_clean_big; //清洗结束时清除
}
else if (t_humid_clean_start>t_outpai_set)
{//加湿器排水时间到后,打开进水阀
PORTD |= b_yv_out; //延时10秒打开排水阀YV-OUT //高水位无连续10秒才可以动作进水阀
if (t_highwater_ok>=10)PORTD |=b_yv_in; //手动进水开进水阀YV-IN开
else PORTD &=~b_yv_in; //PD1进水阀YV-IN关
}
else
{//先打开排水阀
PORTD |= b_yv_out; //
PORTD &=~ b_yv_in;
}
}
void fun_humid_paikong(void) //加湿器排空水
{//20080214当加湿器HUMIN连续闭合时间超过30分钟,断开HUMID,对加湿器进行清洗,
//先打开排水阀、进水阀,加湿器排水时间到后,关闭排水阀,同时打开加湿器,进入电流对比流程
PORTD &=~b_humid; //PG4加湿HUMID关
t_humid_paikong++; //加湿排空计时+1
if (t_humid_paikong>t_outpai_set) //超过加湿排水时间时结束
{//排水时间到后,关闭排水阀,同时打开加湿器,进入电流对比流程
flag |= b_humid_paikong; //加湿排空水结束
t_humid_paikong=0; //
PORTD &= ~ b_yv_out; //加湿排空水结束时,关排水电磁阀
auto_state |=b_humid_clean_end; //加湿清洗结束
}
else
{//先打开排水阀、进水阀,加湿器排水时间到后,关闭排水阀
if (t_highwater_ok>=10)PORTD |=b_yv_in; //手动进水开进水阀YV-IN开
else PORTD &=~b_yv_in; //PD1进水阀YV-IN关
PORTD |= b_yv_out; //开排水阀YV-OUT
}
}
void fun_auto_set_caculate(void) //计算设定值的温度湿度
{
THset10=(int_THset<<3)+(int_THset<<1)+dig_THset; //THset*10+dig_THset=10*THset
fth_actual025 =th_actual10>>2;
switch (th_actual10&0x03)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -