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

📄 currentv.cpp

📁 这是一个水箱的液位控制程序
💻 CPP
字号:
// currentv.cpp : implementation file//#include "stdafx.h"#include "水箱实验.h"#include "currentv.h"#include "conio.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// Ccurrentv dialogCcurrentv::Ccurrentv(CWnd* pParent /*=NULL*/)	: CDialog(Ccurrentv::IDD, pParent){	base=0x0100;	//{{AFX_DATA_INIT(Ccurrentv)		// NOTE: the ClassWizard will add member initialization here	//}}AFX_DATA_INIT}void Ccurrentv::DoDataExchange(CDataExchange* pDX){	CDialog::DoDataExchange(pDX);	//{{AFX_DATA_MAP(Ccurrentv)		// NOTE: the ClassWizard will add DDX and DDV calls here	//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(Ccurrentv, CDialog)	//{{AFX_MSG_MAP(Ccurrentv)	//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// Ccurrentv message handlersBOOL Ccurrentv::OnInitDialog() {	CDialog::OnInitDialog();		// TODO: Add extra initialization here	CString str1;	CString str2;	//int value1=GetData1();  //与硬件连接时取消注释;	int value1=3000;	int value2=4000;	//int value2=GetData2();	float valueshow1=float(value1)*5/4096;	float valueshow2=float(value2)*5/4096;	str1.Format("%4.3f",valueshow1);	str1+="V";	SetDlgItemText(IDC_GETINPUT1,str1);	str2.Format("%4.3f",valueshow2);	str2+="V";	SetDlgItemText(IDC_GETINPUT2,str2);		return TRUE;  // return TRUE unless you set the focus to a control	              // EXCEPTION: OCX Property Pages should return FALSE}int Ccurrentv::GetData1(){//int indata1;	int number=0;	int dl,dh,i;//定义过程变量    int value;	dl=_inp(base+3);	_outp(base,number);//送通道代码	for(i=0;i<1000;i++);//延时	_outp(base+1,0);//启动A/D	do{		;	}while(_inp(base+2)>=128);	dh=_inp(base+2);	dl=_inp(base+3);	value=dh*256+dl; 	return value;}int Ccurrentv::GetData2(){//int indata2;	int number=1;	int dl,dh,i;//定义过程变量    int value;	dl=_inp(base+3);	_outp(base,number);//送通道代码	for(i=0;i<1000;i++);//延时	_outp(base+1,0);//启动A/D	do{		;	}while(_inp(base+2)>=128);	dh=_inp(base+2);	dl=_inp(base+3);	value=dh*256+dl; 	return value;}

⌨️ 快捷键说明

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