Exemplo n.º 1
0
        public bool InitialAxisConfig(AxisCard axisinfo, ProFileType profiletype)
        {
            bool FuncResult = false;
            int  Res;

            Res = CPci9014.p9014_set_alarm(axisinfo.Num, 0, 1);
            if (Res != 0)
            {
                ShowLog("设置对应 DI 为 ALARM 输入端失败!", WriteLogType.Error);
                return(FuncResult);
            }
            Res = CPci9014.p9014_set_pls_outmode(axisinfo.Num, 0);
            if (Res != 0)
            {
                ShowLog("设置 OUT, DIR 引脚输出脉冲方式失败!", WriteLogType.Error);
                return(FuncResult);
            }
            Res = CPci9014.p9014_set_pls_iptmode(axisinfo.Num, 0);
            if (Res != 0)
            {
                ShowLog("设置 OUT, DIR 引脚输出脉冲方式失败!", WriteLogType.Error);
                return(FuncResult);
            }
            Res = CPci9014.p9014_set_el_level(axisinfo.Num, 0);
            if (Res != 0)
            {
                ShowLog("设定限位信号有效电平失败!", WriteLogType.Error);
                return(FuncResult);
            }
            Res = CPci9014.p9014_home_config(axisinfo.Num, 0, 0, 0);
            if (Res != 0)
            {
                ShowLog("配置原点开关有效电平、编码器 index 信号有效电平、回零模式失败!", WriteLogType.Error);
                return(FuncResult);
            }
            if (profiletype == ProFileType.T_Profile)
            {
                Res = CPci9014.p9014_set_t_profile(axisinfo.Num, axisinfo.MinSpeed, axisinfo.MaxSpeed, axisinfo.AccSpeed, axisinfo.DecSpeed);
                if (Res != 0)
                {
                    ShowLog("运动 T 曲线参数设定失败!", WriteLogType.Error);
                    return(FuncResult);
                }
            }
            else
            {
                Res = CPci9014.p9014_set_s_profile(axisinfo.Num, axisinfo.MinSpeed, axisinfo.MaxSpeed, axisinfo.AccSpeed, axisinfo.DecSpeed, 1);
                if (Res != 0)
                {
                    ShowLog("运动 S 曲线参数设定失败!", WriteLogType.Error);
                    return(FuncResult);
                }
            }

            FuncResult = true;
            return(FuncResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取速度曲线运动模式
        /// </summary>
        /// <param name="axisInfo"></param>
        /// <param name="proFileType"></param>
        /// <param name="isShowLog">是否显示日志到UI</param>
        /// <returns>错误代码</returns>
        public override int GetProFile(AxisInfo axisInfo, ProFileType proFileType, bool isShowLog)
        {
            int iRtn = 0;

            if (proFileType == ProFileType.T)
            {
                iRtn = this.Get_T_ProFile(axisInfo, isShowLog);
            }
            else if (proFileType == ProFileType.S)
            {
                iRtn = this.Get_S_ProFile(axisInfo, isShowLog);
            }

            return(iRtn);
        }
Exemplo n.º 3
0
        public int PMove(AxisCard axisinfo, int MovePulse, ProFileType MoveStyle)
        {
            int Res         = 0;
            int BefPosition = this.GetPosition(axisinfo);

            if (MoveStyle == ProFileType.T_Profile)
            {
                Res = CPci9014.p9014_set_t_profile(axisinfo.Num, axisinfo.MinSpeed, axisinfo.MaxSpeed, axisinfo.AccSpeed, axisinfo.DecSpeed);
            }
            else
            {
                Res = CPci9014.p9014_set_s_profile(axisinfo.Num, axisinfo.MinSpeed, axisinfo.MaxSpeed, axisinfo.AccSpeed, axisinfo.DecSpeed, 1);
            }
            Res = CPci9014.p9014_pmove(axisinfo.Num, MovePulse, axisinfo.MoveStyle, 2);
            if (Res != 0)
            {
                ShowLog($"{axisinfo.Name} 运动到脉冲距离:{MovePulse} 失败!", WriteLogType.Error);
                return(2);
            }
            while (true)
            {
                if (this.CheckAxisStatus(axisinfo) == 0)
                {
                    break;
                }
                Thread.Sleep(500);
            }
            int AfPosition = this.GetPosition(axisinfo);

            if (Math.Abs(AfPosition - BefPosition) - Math.Abs(MovePulse) > 1000)
            {
                ShowLog($"{axisinfo.Name}-实际运动脉冲数与目标运动脉冲数误差过大!!", WriteLogType.Error);
            }

            ShowLog($"{axisinfo.Name}-运动到脉冲距离:{MovePulse} 成功!", WriteLogType.Action);
            return(Res);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 获取速度曲线运动模式
 /// </summary>
 /// <param name="axisInfo"></param>
 /// <param name="proFileType"></param>
 /// <param name="isShowLog">是否显示日志到UI</param>
 /// <returns>错误代码</returns>
 public virtual int GetProFile(AxisInfo axisInfo, ProFileType proFileType, bool isShowLog)
 {
     throw new System.NotImplementedException();
 }