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
        private void Form1_Load(object sender, EventArgs e)
        {
            int rc;
            int card_count = 0;

            int[] card_id = new int[16];

            rc = CPci9014.p9014_initial(ref card_count, card_id);
            if (rc != 0)
            {
                MessageBox.Show("Initialize PCI-9014 fail");
            }
            if (card_count < 1)
            {
                MessageBox.Show("Find No PCI-9014 device");
            }
            else
            {
                for (int i = 0; i < card_count; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        axis = card_id[i] * 4 + j;
                        CPci9014.p9014_set_pos(axis, 0, 0);
                        str = Convert.ToString(axis);
                        m_ctlAxisSel.Items.Add(str);
                    }
                }
            }
            textBox1.Text        = "1000";
            textBox2.Text        = "10000";
            textBox3.Text        = "50000";
            textBox4.Text        = "50000";
            textBox5.Text        = " 10000";
            m_ctlAxisSel.Text    = Convert.ToString(card_id[0] * 4);
            m_axis               = card_id[0] * 4;
            radioButton1.Checked = true;
            m_type               = 0;
        }