예제 #1
0
        /// <summary>
        ///     初始化轴
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxisNum">轴数</param>
        protected override short InitAxis(short nCardNum, short nAxisNum)
        {
            short nRtn = 0;

            for (short i = 1; i <= nAxisNum; i++)
            {
                nRtn |= CMc.GT_ZeroPos(nCardNum, i, 1);       //马达位置清零,原点回归完成时也用该指令来置零
                nRtn |= CMc.GT_SetPrfPos(nCardNum, i, 0);     //轴规划位置清零
                Thread.Sleep(200);                            //等待伺服稳定
                nRtn |= CMc.GT_ClrSts(nCardNum, i, nAxisNum); //清楚轴状态
                nRtn |= CMc.GT_AxisOn(nCardNum, i);           //马达伺服使能
            }

            return(nRtn);
        }