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

📄 runshiyan.cpp

📁 开发虚拟的被控对象及虚拟的PLC,模似PLC的工作过程进行实验。用户可根据具体的实验,确定其输入和输出的控制条件,用虚拟的连线和虚拟的PLC连接,用户利用梯形图的编程方式编写PLC程序控制被控对象的动
💻 CPP
字号:


#include "stdafx.h"
#include "PLC_DEMO.h"

#include "PLC_DEMODoc.h"
#include "PLC_DEMOView.h"
#include "Fetch_communicate.h"


extern CPLC_DEMOView *forrun;

extern int signoutput[10];

extern int signinput[8];
bool weigh=false;
bool canjin=true,canjia=true;
bool leveldao=false;
bool canding=true;
int xx=1;
void outtheresult()
{
	if(signoutput[1])
		forrun->GetDlgItem(IDC_EXITSWITCH2)->SetWindowText(
		"on");
	else forrun->GetDlgItem(IDC_EXITSWITCH2)->SetWindowText(
		"off");
	if(signoutput[2])
		forrun->GetDlgItem(IDC_LUMP1)->SetWindowText(
		"on");
	else forrun->GetDlgItem(IDC_LUMP1)->SetWindowText(
		"off");
	if(signoutput[3])
		forrun->GetDlgItem(IDC_LUMP2)->SetWindowText(
		"on");
    else forrun->GetDlgItem(IDC_LUMP2)->SetWindowText(
		"off");
	if(signoutput[4])
		forrun->GetDlgItem(IDC_ELECTROMOTOR1)->SetWindowText(
		"on");
    else forrun->GetDlgItem(IDC_ELECTROMOTOR1)->SetWindowText(
		"off");
	if(signoutput[5])
		forrun->GetDlgItem(IDC_ELECTROMOTOR2)->SetWindowText(
		"on");
    else forrun->GetDlgItem(IDC_ELECTROMOTOR2)->SetWindowText(
		"off");
	if(signoutput[6])
		forrun->GetDlgItem(IDC_ELECTROMOTOR3)->SetWindowText(
		"on");
    else forrun->GetDlgItem(IDC_ELECTROMOTOR3)->SetWindowText(
		"off");
	if(signoutput[7])
		forrun->GetDlgItem(IDC_EXITSWITCH1)->SetWindowText(
		"on");
    else forrun->GetDlgItem(IDC_EXITSWITCH1)->SetWindowText(
		"off");
  
	if (!leveldao)
	{
		signinput[2]=0;
	    forrun->GetDlgItem(IDC_SENSOR1)->SetWindowText(
			"off");
	}
	else 
	{
		signinput[2]=1;
	    forrun->GetDlgItem(IDC_SENSOR1)->SetWindowText(
			"on");
	}
	
		if(signoutput[1]==1)
		leveldao=false;
	
	if(((!leveldao)&&(!signoutput[1]))&&(canding))
	{
		forrun->SetTimer(13,4000,NULL);
		canding=false;
	}
	


	BOOL mm;
	mm=forrun->GetDlgItem(IDC_CAR)->IsWindowVisible();
	if((mm==FALSE)&&(canjin))
	{
		forrun->SetTimer(10,5000,NULL);
		canjin=false;
		signinput[1]=0;
	}
	if(mm==FALSE)
	{
		forrun->GetDlgItem(IDC_SENSOR2)->SetWindowText(
				"off");
	    forrun->GetDlgItem(IDC_SWITCH1)->SetWindowText(
			 "off");
		signinput[1]=0;		
	}
	if((mm==TRUE)&&(!weigh))
	{
		forrun->GetDlgItem(IDC_SWITCH1)->SetWindowText(
			 "on");
		signinput[1]=1;
		if((signoutput[1]==1)&&(canjia))
		{
			forrun->SetTimer(11,12000,NULL);
		    canjia=false;
		}
	   }
	else if(mm==TRUE)
	{
		forrun->GetDlgItem(IDC_SWITCH1)->SetWindowText(
			 "off");
		signinput[1]=0;		
	}
}

⌨️ 快捷键说明

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