📄 flads.cpp
字号:
// FLADS.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "FLADS.h"
#include <stdio.h>
#include "MainFrm.h"
#include "FLADSDoc.h"
#include "FLADSView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFLADSApp
unsigned char BitOPC[8]=
{
0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f
};
unsigned int JBMP[250]=
{
0, 0, 0, 0, 0, 0, 0, 163, 0, 0, // 0-- 9
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10-- 19
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20-- 29
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30-- 39
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40-- 49
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50-- 59
0, 0, 0, 0, 0, 0, 130, 0, 0, 0, // 60-- 69
0, 0, 0, 136, 178, 0, 0, 0, 0, 131, // 70-- 79
132, 133, 135, 138, 139, 140, 141, 142, 182, 213, // 80-- 89
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90-- 99
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //100--109
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //110--119
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //120--129
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //130--139
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //140--149
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //150--159
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //160--169
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //170--179
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //180--189
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //190--199
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //200--209
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //210--219
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //220--229
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //230--239
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //240--249
};
unsigned int JRBMP[250]=
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0-- 9
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10-- 19
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20-- 29
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30-- 39
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40-- 49
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50-- 59
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60-- 69
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70-- 79
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80-- 89
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90-- 99
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //100--109
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //110--119
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //120--129
66, 79, 80, 81, 0, 82, 73, 0, 83, 84, //130--139
85, 86, 87, 0, 0, 0, 0, 0, 0, 0, //140--149
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //150--159
0, 0, 0, 7, 0, 0, 0, 0, 0, 0, //160--169
0, 0, 0, 0, 0, 0, 0, 0, 74, 0, //170--179
0, 0, 88, 0, 0, 0, 0, 0, 0, 0, //180--189
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //190--199
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //200--209
0, 0, 0, 89, 0, 0, 0, 0, 0, 0, //210--219
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //220--229
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //230--239
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //240--249
};
unsigned char BitOPS[8]=
{
0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
};
BEGIN_MESSAGE_MAP(CFLADSApp, CWinApp)
//{{AFX_MSG_MAP(CFLADSApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
//}}AFX_MSG_MAP
// Standard file based document commands
// ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
// ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFLADSApp construction
CFLADSApp::CFLADSApp()
: CWinApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
int i,j;
int m,n;
unsigned char ch;
struct Mail *TempPtr;
FILE *fp;
CString string;
unsigned long ul;
//--------------信息窗初始化-------------------------------------
fp=fopen("\\diskc\\SoeLen.dat","rb");
if(fp==NULL)
{
fp=fopen("\\diskc\\SoeLen.dat","wb");
m=0;
fwrite((int *)&(m),sizeof(int),1,fp);
fclose(fp);
} else
{
fread((int *)&(m),sizeof(int),1,fp);
if(m>200) m=200;
PushLength=m;
fclose(fp);
}
SoeHead.MailQueueLength=0;
SoeHead.MailQueueHead=NULL;
SoeHead.MailQueueTail=NULL;
PostStation.MailQueueLength=0;
PostStation.MailQueueHead=NULL;
for(i=0;i<200;i++)
{
TempPtr=&MailBuf[i];
_fmemset(TempPtr,0,sizeof(struct Mail));
TempPtr->Link=PostStation.MailQueueHead;
PostStation.MailQueueHead=TempPtr;
PostStation.MailQueueLength++;
};
PostStation.TotMailNum=PostStation.MailQueueLength;
_fmemset(SoeBuf,0,200*MaxMailLength);
fp=fopen("\\diskc\\soe.lib","rb");
if(fp==NULL)
{
fp=fopen("\\diskc\\soe.lib","wb");
fwrite((unsigned char *)(SoeBuf),MaxMailLength*200,1,fp);
fclose(fp);
} else
{
fread((unsigned char *)(SoeBuf),MaxMailLength*200,1,fp);
SoeLength=m;
fclose(fp);
}
StartRecord();
j=PushLength;
if(j<0) j=0;
for(i=0;i<200;i++)
{
if(j==0) j=199;
else j--;
HeadorBack=0xff;
if((SoeBuf[j][0]==0xaa)&&(SoeBuf[j][1]==0x55))
{
TWrite(&SoeBuf[j][0]);
}
}
//--------------告警窗初始化-------------------------------------
/* buf[0] //0AAH
buf[1] //055H
buf[2] //命令
buf[3] //长度
buf[4] //年
buf[5] //月
buf[6] //日
buf[7] //时
buf[8] //分
buf[9] //秒
buf[10] //毫秒低
buf[11] //毫秒高
buf[12] //开关序号低字节
buf[13] //开关序号高字节
buf[14] //0:负跳变 1:正跳变
*/
fp=fopen("\\diskc\\WarnLen.dat","rb");
if(fp==NULL)
{
fp=fopen("\\diskc\\WarnLen.dat","wb");
m=0;
fwrite((int *)&(m),sizeof(int),1,fp);
fclose(fp);
}else
{
fread((int *)&(m),sizeof(int),1,fp);
if(m>200) m=200;
WarnLength=m;
fclose(fp);
}
WarnHead.MailQueueLength=0;
WarnHead.MailQueueHead=NULL;
WarnHead.MailQueueTail=NULL;
WarnStation.MailQueueLength=0;
WarnStation.MailQueueHead=NULL;
for(i=0;i<200;i++)
{
TempPtr=&WarnMailBuf[i];
_fmemset(TempPtr,0,sizeof(struct Mail));
TempPtr->Link=WarnStation.MailQueueHead;
WarnStation.MailQueueHead=TempPtr;
WarnStation.MailQueueLength++;
};
WarnStation.TotMailNum=WarnStation.MailQueueLength;
_fmemset(WarnBuf,0,200*MaxMailLength);
fp=fopen("\\diskc\\warn.lib","rb");
if(fp==NULL)
{
fp=fopen("\\diskc\\warn.lib","wb");
fwrite((unsigned char *)(WarnBuf),MaxMailLength*200,1,fp);
fclose(fp);
} else
{
fread((unsigned char *)(WarnBuf),MaxMailLength*200,1,fp);
WarnLength=m;
fclose(fp);
}
j=WarnLength;
if(j<0) j=0;
for(i=0;i<200;i++)
{
if(j==0) j=199;
else j--;
WarnorBack=0xff;
if((WarnBuf[j][0]==0xaa)&&(WarnBuf[j][1]==0x55))
{
WarnWrite(&WarnBuf[j][0]);
}
}
WarnPage=0;
//---------------------------------------------------------------
// WarnorInfo_Flag=0;
ControlMode=MainControl_Window;
exit_flag=0;
rh1_temper_set=120.0;
rh2_temper_set=150.0;
rh3_temper_set=160.0;
sl_temper_set=240.0;
ws1_temper_set=16.0;
ws2_temper_set=20.0;
trans_speed_set=1000.0;
fan_set=1000.0;
FLRType=0;
FreqOut[0]=0;
FreqOut[1]=0;
FreqOut[2]=0;
FreqOut[3]=0;
infonum=0;
WarnFlag=0;
AddHotFlag=0;
HTemperFlag=0;
Year=0;
Month=0;
Day=0;
Hour=0;
Minute=0;
Second=0;
vfds0_control=0;
vfds1_control=0;
vfds2_control=0;
vfds3_control=0;
HOFF_OR_HON=FALSE;
TransConSpeed=0;
vfds0_Frequency=0;
vfds1_Frequency=0;
vfds2_Frequency=0;
vfds3_Frequency=0;
vout=0;
vin=0;
U4018_TT=0x0f; //K型 热电偶
U4018_CC=0x06; //9600 BPS
U4018_FF=0x80; //
U4012_TT=0x08; //输入类型 (+-)10V ;
U4012_CC=0x06; //波特率 9600
U4012_FF=0x80; //
U4021_TT=0x40;
U4021_CC=0x06;//波特率 9600
U4021_FF=0x00;
ykout[0]=0xff;//ykout0
ykout[1]=0xff;//ykout1
ykout[2]=0xff;//ykout2
ykout[3]=0xff;//ykout3
second_run=0;
minute_run=0;
hour_run=0;
date_run=0;
BoardInCount=0;
BoardInSts=1;
OldBoardInSts=1;
yxbuf00=0xff;
oldyxbuf00=0xff;
board_infg=0;
yxbuf01=0xff;
BoardScale=0;
for(i=0;i<10;i++)
{
temper_value[i]=0;
Warn[i]=0;
OldWarn[i]=0;
old_temper_count[i]=0;
old_temper_value[i]=0;
}
A4018_TT=0;
A4018_CC=0;
A4018_FF=0;
ver_sum=0;
workmode=0;
RSCASE=0;
Com2_RSCASE=0;
SETRSCASE=0;
AUTO_SETRCASE=0;
PW_Count=38;
pass=0;
FanRun_Flag=0;
hotrflag=0;
old_hotrflag=0;
LowpMode=0;
BoardLength=0;
for(i=0;i<400;i++)
{
templib[i]=0;
powerlib[i]=0;
flowlib[i]=0;
}
for(i=0;i<6;i++) KR[i]=0;
sample=0;
samplecount=0;
DownLoad_flag=0;
old_bottomflag=0;;
bottomflag=0;
bottomcount=0;
old_leftflag=0;;
leftflag=0;
leftcount=0;
old_fan1flag=0;;
fan1flag=0;
fan1count=0;
pid_switch=0;
rh1_switch=0;
rh2_switch=0;
rh3_switch=0;
sl_switch=0;
ws1_switch=0;
ws2_switch=0;
pass_set=0;
pass_para=0;
pass_exit=0;
old_fan2flag=0;;
fan2flag=0;
fan2count=0;
WarnStatus=0;
WarnDelay=0;
WarnCase=0;
for(i=0;i<5;i++) WarnNum[i]=0;
AirTemp=0;
WaterVolume=0;
RecordFlag=0;
RecordCount=0;
RecordTime=0;
oldend=0;
SoePage=0;
Pid_Channel=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -