/// <summary> /// 吋動 (自定義速度,初速為恆速1/2,加速度減速度為軸參手動設定) /// </summary> /// <param name="speed">速度值 (millimeter).</param> /// <param name="dir">吋動方向</param> public void JogM(double speed, RotationDirection dir) { byte bDir; if (dir == RotationDirection.CW) { bDir = 1; } else { bDir = 0; } if (axisPara.IsActive && axisPara.Enabled) { int 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); /* * //不確定速度設定與速度移動是否有先後順序,所以才這樣寫。 * if (!this.IsBusy) * { * CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM); * } * else * { * CMNET_L132.CS_mnet_m1_v_change((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, (double)i, 0.1); * } * if (!this.IsBusy) * { * CMNET_L132.CS_mnet_m1_v_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, bDir); * }*/ } }
/// <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); } }