예제 #1
0
파일: L132M1X1.cs 프로젝트: jajanuj/GitTest
        /// <summary>
        /// 吋動 (軸參設定的五個速度值)
        /// </summary>
        /// <param name="speedIndex">軸參之吋動速度</param>
        /// <param name="dir">吋動方向</param>
        public void Jog(JogSpeed jogSpeed, RotationDirection dir)
        {
            byte bDir;

            if (dir == RotationDirection.CW)
            {
                bDir = 1;
            }
            else
            {
                bDir = 0;
            }
            if (axisPara.IsActive && axisPara.Enabled)
            {
                double speed = 0;
                int    i     = 0;
                switch (jogSpeed)
                {
                case JogSpeed.Micro:
                    speed = axisPara.JogMicroSpeed;
                    break;

                case JogSpeed.Low:
                    speed = axisPara.JogLowSpeed;
                    break;

                case JogSpeed.Mid:
                    speed = axisPara.JogMidSpeed;
                    break;

                case JogSpeed.High:
                    speed = axisPara.JogHighSpeed;
                    break;

                case JogSpeed.Max:
                    speed = axisPara.JogMaxSpeed;
                    break;
                }
                i = MmToPulse(speed);
                CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM);
                CMNET_L132.CS_mnet_m1_v_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, bDir);
            }
        }