Exemple #1
0
        /// <summary>
        /// 查找并初始化系统里面所有的 PCI-9014
        /// </summary>
        /// <returns></returns>
        public override int Init()
        {
            int rc;
            int boarkCount = 0;

            int[] card_id = new int[16];
            //初始化运动轴;
            rc = CPci9014.p9014_initial(ref boarkCount, card_id);
            if (rc != 0)
            {
                Log.GetInstance().ErrorWrite("Initialize PCI-9014 fail");

                return(1);
            }
            //PCI9014的数目;
            //boarkCount = 1;
            if (boarkCount < 1)
            {
                Log.GetInstance().ErrorWrite("Find No PCI-9014 device");
                return(1);
            }
            //获取运动轴的参数
            if (!GetParameter())
            {
                return(1);
            }
            else
            {
                Log.GetInstance().NormalWrite("获取运动轴参数成功!!");
            }
            foreach (var Axis in Global.LstAxis)
            {
                //设置运动参数
                //Alarm 0:低有效  1: 高有效
                rc &= CPci9014.p9014_set_alarm(Axis.No, 0, 1);

                //0:PULSE/DIR  1: CW/CCW
                rc &= CPci9014.p9014_set_pls_outmode(Axis.No, 0);

                //0:PULSE/DIR  1:4X AB
                rc &= CPci9014.p9014_set_pls_iptmode(Axis.No, 0);

                //EL Level 0:低有效  1: 高有效
                rc &= CPci9014.p9014_set_el_level(Axis.No, 0);

                //mode(0:ORG Only  1:ORG+EZ)
                //ORG Level(0:低有效  1: 高有效)
                //EZ  Level(0:低有效  1: 高有效)
                rc &= CPci9014.p9014_home_config(Axis.No, 0, 0, 0);

                //设置T Profile 下的速度,加速度等参数
                rc &= CPci9014.p9014_set_t_profile(Axis.No, Axis.startSpeed, Axis.maxSpeed, Axis.AccTime, Axis.DecTime);
            }
            //关闭所有输出
            SetAllOutBit(false);
            return(rc);
        }
Exemple #2
0
 public override int SetPlsOutmode(PCI9014AxisInfo axinfo, int plsOutMode)
 {
     return(CPci9014.p9014_set_pls_outmode(axinfo.No, plsOutMode));;
 }