コード例 #1
0
        /// <summary>运动控制卡初始化 </summary>

        internal void Open()
        {
            AxisCount = HTM.GetAxisNum();
            if (AxisCount > 0)
            {
                axisHomeDones   = new bool[AxisCount];
                detectHomeDones = new Thread[AxisCount];
                _motionParams   = new JFMotionParam[AxisCount];
                for (int i = 0; i < AxisCount; i++)
                {
                    HTM.AXIS_INFO ai;
                    HTM.GetAxisInfo(i, out ai);
                    HTM.MOTION_PARA mp = HTM.GetMotionPara(i);//HTM.GetMovePara(i, out mp);
                    //if (ret != 0)
                    //{
                    //    AxisCount = 0;
                    //    _motionParams = null;
                    //    throw new Exception(string.Format("MC_Htm.Init Failed :HTM.GetMovePara(axis = {0}) return errorCode = {1}", i, ret));
                    //}
                    _motionParams[i]       = new JFMotionParam();
                    _motionParams[i].vs    = mp.vStart;
                    _motionParams[i].vm    = mp.vMax;
                    _motionParams[i].ve    = mp.vEnd;
                    _motionParams[i].acc   = mp.acc;
                    _motionParams[i].dec   = mp.dec;
                    _motionParams[i].curve = mp.sFactor;
                    _motionParams[i].jerk  = 0;
                    axisHomeDones[i]       = false;
                    detectHomeDones[i]     = new Thread(new ParameterizedThreadStart(FuncDetectHomeDone));
                }
            }
            IsOpen = true;
        }