示例#1
0
        //获取指定轴的运动状态
        public override void GetAxisRunState(int Axis, out int State, out string ErrorMessage)
        {
            State = -1;
            string TempErrorMessage = "";

            State = Dmc1000_Dll.d1000_check_done(Axis);
            switch (State)
            {
            case 0:
                TempErrorMessage = "正在运行";
                break;

            case 1:
                TempErrorMessage = "脉冲输出完毕停止";
                break;

            case 2:
                TempErrorMessage = "指令停止";
                break;

            case 3:
                TempErrorMessage = "遇限位停止";
                break;

            case 4:
                TempErrorMessage = "遇原点停止";
                break;

            default:
                break;
            }

            ErrorMessage = TempErrorMessage;
        }
示例#2
0
        //写输出端口
        public override bool WriteOutputPortBit(int Axis, int Board_ID, int PortNumber, int PortBitData, 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_out_bit(PortNumber, PortBitData);


            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "输出端口写入失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "输出端口写入正常";
            }

            return(true);
        }
示例#3
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);
        }
示例#4
0
        //紧急停止
        public override bool Immediate_Stop(int Axis, int Position, 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_immediate_stop(Axis);
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴紧急停止失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴紧急停止成功";
            }

            return(true);
        }
        //减速停止
        public override bool DecSpeedStop(int Axis, int StopSpedDec, int Position, 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_decel_stop(Axis);
            if (State != ERR_NoError)
            {//
                ErrorMessage = Convert.ToString(Axis) + "轴减速停止设置失败";
                return(false);
            }
            else
            {//
                ErrorMessage = Convert.ToString(Axis) + "轴减速停止设置成功";
            }

            return(true);
        }
示例#6
0
        //设置轴当前位置
        public override bool SetAxisCurrestPosition(int Axis, int Position, 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_set_command_pos(Axis, Position);
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴当前位置设置失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴当前位置设置成功";
            }

            return(true);
        }
示例#7
0
        //梯形速度运动(T梯形速度曲线)
        public override bool AxisVelocityMove_T(int Axis, int MaxSpeed, int StopSpedDec, double Curve, Double AccSpeed, string DecSpeed, string Direct, int Position, int StartSpeed, 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_start_tv_move(Axis, StartSpeed, MaxSpeed, AccSpeed);
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴T型速度运动失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴T型速度运动成功";
            }

            return(true);
        }
示例#8
0
        //绝对点到点运动(S梯形速度曲线)
        public override bool AxisAbsolutionMovePTP_S(int Axis, int Position, int StartSpeed, int MaxSpeed, Double AccSpeed, 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_start_sa_move(Axis, Position, StartSpeed, MaxSpeed, AccSpeed);
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴绝对运动失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴绝对运动成功";
            }

            return(true);
        }
示例#9
0
        //相对点到点运动(T梯形速度曲线)
        public override bool AxisRelativeMovePTP_T(int Axis, double Curve, int StartSpeed, double AccSpeed, double DecSpeed, int MaxSpeed, int StopSpeed, int Distance, bool Synchronous, double DelayTime, 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_start_t_move(Axis, Distance, StartSpeed, MaxSpeed, AccSpeed);
            if (State != ERR_NoError)
            {
                ErrorMessage = Convert.ToString(Axis) + "轴相对运动失败";
                return(false);
            }
            else
            {
                ErrorMessage = Convert.ToString(Axis) + "轴相对运动成功";
            }

            return(true);
        }
        //读输入端口
        public override bool ReadInputPortBit(int Axis, int Board_ID, int PortNumber, out int PortBitData, int AccEnable, int PulseMode, out string ErrorMessage)
        {//
            int State = -1;

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


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


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



            PortBitData = Dmc1000_Dll.d1000_in_bit(PortNumber);

            return(true);
        }