📄 comm.cpp
字号:
{
case 0:dx=theApp.temper_value[1];
dy=theApp.WarnSetON[i]+theApp.rh1_temper_set;
break;
case 1:dx=theApp.temper_value[2];
dy=theApp.WarnSetON[i]+theApp.rh2_temper_set;
break;
case 2:dx=theApp.temper_value[3];
dy=theApp.WarnSetON[i]+theApp.rh3_temper_set;
break;
case 3:dx=theApp.temper_value[0];
dy=theApp.WarnSetON[i]+theApp.sl_temper_set;
break;
}
if(dx>=dy)
{//超温状态
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,130+i))
{
j++;
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,104+i);
}else
{
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,104+i);
}
}else
{
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,104+i);
}
//=====超温切除接触器=====================
if(dx>=(dy+20))
{//超温状态
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,130+i))
{
switch(i)
{
case 0:theApp.sw_off[0]++;
if(theApp.sw_off[0]>100)
{
theApp.sw_off[0]=101;
theApp.YKOUTPUT(YK_RH1_ACON,YKOFF);/* 预热接触器1 */
}
break;
case 1:theApp.sw_off[1]++;
if(theApp.sw_off[1]>100)
{
theApp.sw_off[1]=101;
theApp.YKOUTPUT(YK_RH2_ACON,YKOFF);/* 预热接触器2 */
}
break;
case 2:theApp.sw_off[2]++;
if(theApp.sw_off[2]>100)
{
theApp.sw_off[2]=101;
theApp.YKOUTPUT(YK_RH3_ACON,YKOFF);/* 预热接触器3 */
}
break;
case 3:theApp.sw_off[3]++;
if(theApp.sw_off[3]>100)
{
theApp.sw_off[3]=101;
theApp.YKOUTPUT(YK_RH_POWER,YKOFF);/* 锡炉 */
theApp.YKOUTPUT(YK_WS1_JON,YKOFF);
theApp.YKOUTPUT(YK_WS2_JON,YKOFF);
}
break;
}
}else
{
switch(i)
{
case 0:theApp.sw_off[0]=0;
break;
case 1:theApp.sw_off[1]=0;
break;
case 2:theApp.sw_off[2]=0;
break;
case 3:theApp.sw_off[3]=0;
break;
}
}
}else
{
switch(i)
{
case 0:theApp.sw_off[0]=0;
break;
case 1:theApp.sw_off[1]=0;
break;
case 2:theApp.sw_off[2]=0;
break;
case 3:theApp.sw_off[3]=0;
break;
}
}
}//for
for(i=0;i<4;i++)
{//-----低温状态----------------------
switch(i)
{
case 0:dx=theApp.temper_value[1];
dy=theApp.rh1_temper_set-theApp.WarnSetOF[i];
break;
case 1:dx=theApp.temper_value[2];
dy=theApp.rh2_temper_set-theApp.WarnSetOF[i];
break;
case 2:dx=theApp.temper_value[3];
dy=theApp.rh3_temper_set-theApp.WarnSetOF[i];
break;
case 3:dx=theApp.temper_value[0];
dy=theApp.sl_temper_set-theApp.WarnSetOF[i];
break;
}
if(dx<dy)
{//低温状态
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,130+i))
{
j++;
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,108+i);
}else
{
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,108+i);
}
}else
{
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,108+i);
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,116))
{//黄灯亮
if(theApp.second_run>600)
{
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,119+i);
}
}
}
}//for
if(j==0)
{//恒温状态
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,112);
}else
{
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,112);
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,116))
{//黄灯亮
theApp.YKOUTPUT(YK_YEW_LED,YKON);
theApp.AddHotFlag=0xff;
}else
{//黄灯灭
theApp.YKOUTPUT(YK_YEW_LED,YKOFF);
theApp.AddHotFlag=0;
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,119);
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,120);
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,121);
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,122);
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,117))
{//绿灯亮
theApp.YKOUTPUT(YK_YEW_BLUE,YKON);
theApp.HTemperFlag=0xff;
}else
{//绿灯灭
theApp.YKOUTPUT(YK_YEW_BLUE,YKOFF);
theApp.HTemperFlag=0;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,125))
{//红灯亮
theApp.YKOUTPUT(YK_RED_LED,YKON);
theApp.WarnFlag=0xff;
}else
{//红灯灭
if(theApp.warncode!=0)
{
theApp.YKOUTPUT(YK_RED_LED,YKON);
theApp.WarnFlag=0xff;
}else
{
theApp.YKOUTPUT(YK_RED_LED,YKOFF);
theApp.WarnFlag=0;
}
}
j=0;
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,64))
{//1号4018通信
theApp.warncode=0x02;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,5))
{//运输马达过载
theApp.warncode=0x06;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,7))
{//排风马达过载
theApp.warncode=0x07;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,8))
{//波峰马达1过载
theApp.warncode=0x08;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,9))
{//波峰马达2过载
theApp.warncode=0x09;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,1))
{//紧急停止
theApp.warncode=0x05;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,142))
{//预热一低温报警!
theApp.warncode=0x0f;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,143))
{//预热二低温报警!
theApp.warncode=0x10;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,144))
{//预热三低温报警!
theApp.warncode=0x11;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,145))
{//锡炉低温报警
theApp.warncode=0x0D;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,146))
{//预热一超温报警!
theApp.warncode=0x0A;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,147))
{//预热二超温报警!
theApp.warncode=0x0B;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,148))
{//预热三超温报警!
theApp.warncode=0x0E;
j++;
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,149))
{//锡炉超温报警!
theApp.warncode=0x0C;
j++;
}
if((theApp.plc_con_ret[1] & 0x0002)!=0)
{
if( theApp.yxtask.BitTestChar(theApp.yxtask.krbuf,136) )
{
if( theApp.Contrans_Count>=120 )
{
theApp.warncode=0x12;
j++;
}
}else
{
if(theApp.Contrans_Soe_Flag!=0)
{
theApp.warncode=0x12;
j++;
}
}
}
if(theApp.Com2_Status !=0)
{
if(theApp.pw_type==0)
{
theApp.warncode=0x13;
j++;
}
}
if(j==0) theApp.warncode=0;
if(theApp.reset_mulse!=0)
{//复位脉冲
theApp.reset_count++;
if(theApp.reset_count>=4)
{
theApp.reset_count=0;
theApp.reset_mulse=0;
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,126);
}
}
if(theApp.boardbase_mulse!=0)
{//
theApp.boardbase_count++;
if(theApp.boardbase_count>=4)
{
theApp.boardbase_count=0;
theApp.boardbase_mulse=0;
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,57);
}
}
if(theApp.yxtask.BitTestChar(theApp.yxtask.yxbuf,11))
{//电源切换 UPS工作:只开传送带
//-----关预热1----------------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,130);
theApp.YKOUTPUT(YK_RH1_ACON,YKOFF);/* 预热接触器1 */
theApp.rh1_switch=0x00;
//-----关预热2----------------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,131);
theApp.YKOUTPUT(YK_RH2_ACON,YKOFF);/* 预热接触器2 */
theApp.rh2_switch=0x00;
//-----关预热3----------------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,132);
theApp.YKOUTPUT(YK_RH3_ACON,YKOFF);/* 预热接触器3 */
theApp.rh3_switch=0x00;
//--------关风机--------------------
theApp.FanOff();
//--------关锡炉--------------------
if(theApp.ups_flag==0)
{
theApp.ups_sl_switch=theApp.sl_switch;
}
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,133);
theApp.sl_up_count=0;
theApp.sl_switch=0x00;
theApp.YKOUTPUT(YK_RH_POWER,YKOFF);
//----------波峰一关 ---------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,134);
theApp.YKOUTPUT(YK_WS1_JON,YKOFF);
theApp.ws1_switch=0x00;
//----------波峰二关----------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,135);
theApp.YKOUTPUT(YK_WS2_JON,YKOFF);
theApp.ws2_switch=0x00;
//--------连喷关--------------------
theApp.SelfCheckFlag=0;
theApp.plc_control=theApp.plc_control & 0xfffd;
//--------洗爪关--------------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,140);
theApp.YKOUTPUT(YK_CFOOT_JON,YKOFF);
//-------喷雾关----------------------
theApp.yxtask.BitClrChar(theApp.yxtask.krbuf,137);
theApp.plc_control=theApp.plc_control & 0xfffe;
theApp.ups_flag=0xff;
}else
{
if(theApp.ups_flag!=0)
{
if(theApp.ups_sl_switch!=0)
{// 锡炉开
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,133);
theApp.YKOUTPUT(YK_RH_POWER,YKON);
theApp.sl_switch=0xff;
theApp.pid_switch=0xff;
theApp.sl_up_count=0;
}
}
theApp.ups_flag=0;
}
if(theApp.Auto_Flag!=0)
{
if(theApp.Auto_Flag_Init==0)
{
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,129);
theApp.sl_up_count=0;
theApp.YKOUTPUT(POWER_24, YKON);
theApp.yxtask.BitSetChar(theApp.yxtask.krbuf,128);
}
}
theApp.InitWeekSet();
}
return TRUE;
}
BOOL BeginWarn()
{
if (WarnRun == FALSE)
{
WarnRun = TRUE;
WarnThreadHandle = CreateThread(
(LPSECURITY_ATTRIBUTES)NULL, // pointer to thread security attributes
0, // initial thread stack size, in bytes
(LPTHREAD_START_ROUTINE)WarnThread, // pointer to thread function
NULL, // argument for new thread
0, // creation flags
&WarnThreadId // pointer to returned thread identifier
);
}
return TRUE;
}
BOOL EndWarn()
{
if(WarnRun == TRUE)
{
WarnRun = FALSE;
Sleep(100);
CloseHandle(WarnThreadHandle);
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -