当前位置: 首页 > article >正文

MFC工控项目实例三十实现一个简单的流程

  启动按钮夹紧 密闭,时间0到平衡 进气,时间1到进气关,时间2到平衡关 检测,时间3到平衡 排气,时间4到夹紧开、密闭开、排气关。

 相关代码

void CSEAL_PRESSUREDlg::OnTimer_2(UINT nIDEvent_2)
{

           
		  // if (nIDEvent_2==1 && t_time_2<=theApp.m_sys_data.m_fMaxTime*10)
     if (nIDEvent_2==1 )
		{
		     t_time_1++;			

                   YRandom = rand()%3; // Generate Random data  
                    m_ctrlPlot_1.GetChannel(0).AddXY(t_time_1/10, YRandom );
					
					 	
	 } 
         
	
	       if (nIDEvent_2==1 && t_time_2<theApp.m_edit_time0*10)
		  {
			   t_time_2++;
			  DO6408Bit(theApp.nAddr_1,theApp.O_1[0],1);//夹紧		
			  DO6408Bit(theApp.nAddr_1,theApp.O_1[1],1);//密闭
                
			 
			  SetDlgItemText(IDC_EDIT_MESSAGE,"夹紧 密闭");
	       	
		 } 
	     else if ( t_time_2<theApp.m_edit_time1)
		  {
			   t_time_2++;
			  DO6408Bit(theApp.nAddr_1,theApp.O_1[3],1);//平衡开
			  DO6408Bit(theApp.nAddr_1,theApp.O_1[2],1);//进气			  
			  SetDlgItemText(IDC_EDIT_MESSAGE,"夹紧 密闭\r\n平衡 进气");
           
	       	
		 }
			else if ( t_time_2<theApp.m_edit_time2)
			{ 
				  t_time_2++;
				 DO6408Bit(theApp.nAddr_1,theApp.O_1[2],0);//进气关
			     SetDlgItemText(IDC_EDIT_MESSAGE,"夹紧 密闭\r\n平衡 进气\r\n进气关");
			     
			}
			  else if (t_time_2<theApp.m_edit_time3)
			  {
				   t_time_2++;
				  DO6408Bit(theApp.nAddr_1,theApp.O_1[3],0);//平衡关\检测
				 SetDlgItemText(IDC_EDIT_MESSAGE,"夹紧 密闭\r\n平衡 进气\r\n进气关\r\n平衡关 检测");
                
			  }
			    else if (t_time_2<theApp.m_edit_time4)
			  {
				 t_time_2++;
				    DO6408Bit(theApp.nAddr_1,theApp.O_1[3],1);//平衡开
			    	DO6408Bit(theApp.nAddr_1,theApp.O_1[4],1);//排气开
                 SetDlgItemText(IDC_EDIT_MESSAGE,"夹紧 密闭\r\n平衡 进气\r\n进气关\r\n平衡关 检测\r\n平衡 排气");
			  }
                 else 
				 {
                  DO6408Bit(theApp.nAddr_1,theApp.O_1[4],0);//排气关
				  DO6408Bit(theApp.nAddr_1,theApp.O_1[3],0);//排气关
				  DO6408Bit(theApp.nAddr_1,theApp.O_1[0],0);//夹紧松
				  DO6408Bit(theApp.nAddr_1,theApp.O_1[1],0);//密闭松
				 SetDlgItemText(IDC_EDIT_MESSAGE,"结束");
				 
    theApp.m_edit_time1= theApp.m_allPara[theApp.m_nProductSel].m_edit_time1;
	theApp.m_edit_time2= theApp.m_allPara[theApp.m_nProductSel].m_edit_time2;
	theApp.m_edit_time3= theApp.m_allPara[theApp.m_nProductSel].m_edit_time3;
	theApp.m_edit_time4= theApp.m_allPara[theApp.m_nProductSel].m_edit_time4;
				   DestroyTimer();
				   DestroyTimer_2();
				 } 
		  
		  
}


http://www.kler.cn/a/396416.html

相关文章:

  • 函数式编程(4) 纯函数
  • docker与大模型(口语化原理和实操讲解)
  • CloudSim 里CloudletScheduler类
  • 使用importlib动态导入python类
  • Codeforces Round 987 (Div. 2)(前四道)
  • 开发需求总结17-vue echart报错:Cannot read property get ‘Attribute‘ of undefined
  • 基于PHP技术的校园站的设计与实现
  • ​‌华为交换机在Spine-Leaf架构中的使用场景​
  • 我谈二值形态学基本运算——腐蚀、膨胀、开运算、闭运算
  • java xml 文本解析
  • git如何开启SSH?
  • vcenter service基本异常处理
  • rom定制系列------红米10x 5G版本安卓12-miui14批量线刷固件
  • 鸿蒙实战:页面跳转
  • FromData格式提交接口时入参被转成JSON格式问题
  • 前端(3)——快速入门JaveScript
  • uni-app移动端与PC端兼容预览PDF文件
  • Rust 语言学习笔记(四)
  • Qt中实现旋转动画效果
  • Electron 项目启动外部可执行文件的几种方式