示例#1
0
        //原点归位
        public override bool AxisReturnHome(int Axis, int OriginMode, int OriginDirect, double Curve, double AccSpeed, int DecSpeed, int StartSpeed, int OriginLocationSpeed, bool Synchronous, double DelayTime, int EZA, int SHIFT, int POSITION, int MaxSpeed, int AccEnable, int PulseMode, out string ErrorMessage)
        {
            int State = -1;

            if (Dmc1000_Dll.d1000_check_done(Axis) == 0)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴正在运行";
                return(false);
            }


            State = Dmc1000_Dll.d1000_set_sd(Axis, AccEnable);//设置减速开关是否有效
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴设置减速信号使能失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴设置减速信号使能成功";
            }


            State = Dmc1000_Dll.d1000_set_pls_outmode(Axis, PulseMode);//设置控制卡脉冲输出模式
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴设置控制卡脉冲输出模式失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴设置控制卡脉冲输出模式成功";
            }


            State = Dmc1000_Dll.d1000_home_move(Axis, StartSpeed, MaxSpeed, AccSpeed);//原点归位
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴原点归位失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴指令运行正常";
            }

            return(true);
        }