| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 638 人关注过本帖
标题:这个计时器发挥的作用是啥》》真不懂撒
只看楼主 加入收藏
绝伦
Rank: 1
等 级:新手上路
帖 子:67
专家分:3
注 册:2011-10-10
结帖率:63.64%
收藏
已结贴  问题点数:20 回复次数:2 
这个计时器发挥的作用是啥》》真不懂撒
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
xydddaxia
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:33
帖 子:466
专家分:2307
注 册:2009-3-20
收藏
得分:10 
代码不全,看不懂

站在春哥的肩膀上
2012-02-27 13:50
w024680
Rank: 4
等 级:业余侠客
帖 子:53
专家分:259
注 册:2010-7-27
收藏
得分:10 
应该是记录代码执行的时间
System.Diagnostics.Debug.WriteLine("Main Loop expired " + ht.DurationInMs.ToString("0") + "mS");


[ 本帖最后由 w024680 于 2012-3-3 06:07 编辑 ]

ら.花舞花落泪 | ら.花哭花瓣飞
2012-03-03 06:06
快速回复:这个计时器发挥的作用是啥》》真不懂撒
数据加载中...
 
   



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

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