| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 638 人关注过本帖
标题:这个计时器发挥的作用是啥》》真不懂撒
取消只看楼主 加入收藏
绝伦
Rank: 1
等 级:新手上路
帖 子:67
专家分:3
注 册:2011-10-10
结帖率:63.64%
收藏
已结贴  问题点数:20 回复次数:0 
这个计时器发挥的作用是啥》》真不懂撒
private int RealDataCount = 0;
        private int ReadDataCount = 1;
        private int numXX = 0;
        private int operMode = 0;
        Boolean busy = false;

        /// <summary>
        /// 时间计时器定时查询信息
        /// </summary>
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (busy)
                return;
            busy = true;
            myAPI.HiPerfTimer ht = new myAPI.HiPerfTimer();
            ht.Start();                          //调用开始计时方法
            if (GlobalVars.StartOver)                    
            {
                if (operMode == 0)
                {
                    ReadPLC(Globalvar.Info[0]);
                    ReadPLC(Globalvar.Info[1]);  //PLC读取1#和2#车对应基本信息数据
                    Display(EAFInst);            //显示画面信息
                }
                else
                {
                   if (RealDataCount == 0)
                    {
                        WriteRTData();         //向LF_RT表中更新数据
                    }

                    if (ReadDataCount == 0)
                    {

                        DealEvent(Globalvar.Info[numXX]);//相应冶炼事件
                        ReadSample(Globalvar.Info[numXX]);//取样信息
                        if (ReadDB.ReadVechInfo(Globalvar.Info[numXX]))
                        {
                            DealEvent(Globalvar.Info[numXX]);
                        }

                        numXX = (numXX + 1) % 2;
                    }
                }
                ReadDataCount = (ReadDataCount + 1) % GlobalVars.AllCS.RealTime; //realtime为实时数据发送间隔
                RealDataCount = (RealDataCount + 1) % GlobalVars.AllCS.RealTime;
                operMode = (operMode + 1) % 2;
            }
            ht.Stop();  //停止计时
            System.Diagnostics.Debug.WriteLine("Main Loop expired " + ht.DurationInMs.ToString("0") + "mS");
            busy = false;
        }
搜索更多相关主题的帖子: 计时器 void private return false 
2012-02-23 19:01
快速回复:这个计时器发挥的作用是啥》》真不懂撒
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029854 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved