本帖最后由 bobzhang1985 于 2012-02-22 15:56:23 编辑

解决方案 »

  1.   

    你的while在哪里,如果while里面没有让出时间给cpu那么cpu会被占满的,while内部最好sleep一点时间
      

  2.   

    不好意思 刚刚怎么打错了
    private bool MotionMove(short _AxisNo, double _dist, double _speed, int _stopState)
            {
                retVal = C152.c152_start_tr_move(_AxisNo, _dist, 0, _speed, 0.01, 0.01);//发送信号            EndTime = DateTime.Now;
                TimeSpan ts = EndTime - BeginTime;
                while(_stopState)    //循环,等待脉冲发送完的信号
               {
                    if (Math.Abs(ts.TotalSeconds) > 20)
                    {
                        ShowInf("发送脉冲超时");
                        return false;
                    } 
                    .....
                }
             }
      

  3.   


    请问是为什么? showinf只在大于20秒后 显示下"发送脉冲超时" 而且一次运行就 return false 跳出了