Example #1
0
        private void button5_MouseDown(object sender, MouseEventArgs e)
        {
            mc.TJogPrm jopPra = new mc.TJogPrm();
            jopPra.acc = 0.25;
            jopPra.dec = 0.25;
            double value = Convert.ToDouble(numericUpDown3.Value);

            MotionPunction.JogMotin(0, 1, jopPra, -value);
        }
Example #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            mc.TJogPrm jopPra = new mc.TJogPrm();
            jopPra.acc = 0.25;
            jopPra.dec = 0.25;
            double value = Convert.ToDouble(numericUpDown1.Value);

            while (true)
            {
                MotionPunction.JogMotin(0, 1, jopPra, value);
                AxiCondition.AxiSituation axiSituation = new AxiCondition.AxiSituation();
                axiSituation = AxiCondition.JustReadCondition(1, 0);
                if (axiSituation.negativeLimit || axiSituation.positveLimit)
                {
                    MotionPunction.GoSafetyPosition(1, 0);
                    break;
                }
            }
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            mc.TTrapPrm trap = new mc.TTrapPrm();
            trap.acc        = 0.25;
            trap.dec        = 0.125;
            trap.smoothTime = 25;
            MotionPunction.TrapParameter tp = new MotionPunction.TrapParameter();
            tp.position = Convert.ToInt32(numericUpDown2.Value);
            tp.sleep    = Convert.ToInt32(numericUpDown1.Value);
            MotionPunction.Trap(true, trap, tp, 1);
            //int AxiStatus;
            //uint pClock;
            //short sRtn1 = mc.GT_GetSts(0,1,out AxiStatus,1,out pClock);
            //if ((AxiStatus&0x2)==0x2&&(AxiStatus&0x20)==0x20)
            //{
            //    MessageBox.Show("伺服报警或处于正限位");
            //}
            //else
            //{
            //    short sRtn;
            //    mc.TTrapPrm trap;

            //    //清除各轴的报警和限位
            //    sRtn = mc.GT_ClrSts(0,1, 8);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("清除出错");
            //    }
            //    // 伺服使能
            //    sRtn = mc.GT_AxisOn(0,1);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("使能出错");
            //    }
            //    // 位置清零
            //    sRtn = mc.GT_ZeroPos(0,1,1);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("位置清出错");
            //    }
            //    // AXIS轴规划位置清零
            //    sRtn = mc.GT_SetPrfPos(0,1, 0);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("规划出错");
            //    }
            //    // 将AXIS轴设为点位模式
            //    sRtn = mc.GT_PrfTrap(0,1);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("模式出错");
            //    }
            //    // 读取点位运动参数
            //    sRtn = mc.GT_GetTrapPrm(0,1, out trap);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("读取参数出错");
            //    }
            //    trap.acc = 0.25;
            //    trap.dec = 0.125;
            //    trap.smoothTime = 25;
            //    // 设置点位运动参数
            //    sRtn = mc.GT_SetTrapPrm(0,1, ref trap);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("设置参数出错");
            //    }
            //    // 设置AXIS轴的目标位置
            //    int posation = Convert.ToInt32(numericUpDown2.Value);
            //    sRtn =mc.GT_SetPos(0,1, posation);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("位置出错");
            //    }
            //    // 设置AXIS轴的目标速度
            //    double 速度 = Convert.ToDouble(numericUpDown1.Value);
            //    sRtn = mc.GT_SetVel(0,1, 速度);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("速度出错");
            //    }
            //    // 启动AXIS轴的运动
            //    sRtn = mc.GT_Update(0,1);
            //    if (sRtn != 0)
            //    {
            //        MessageBox.Show("运动出错");
            //    }
            //}
        }
Example #4
0
 private void button6_Click(object sender, EventArgs e)
 {
     MotionPunction.GoHome(1, 0);
 }