/// <summary> /// 吋動 (軸參設定的五個速度值) /// </summary> /// <param name="speedIndex">軸參之吋動速度</param> /// <param name="dir">吋動方向</param> public void Jog(JogSpeed jogSpeed, RotationDirection dir) { 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); CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM); CCMNet.CS_mnet_m1_v_move(RingNoOfMNet, axisPara.SlaveIP, Convert.ToByte(dir)); } }
public void JogConsiderSoftLimit(JogSpeed jogSpeed, RotationDirection dir) { I16 rc = -1; if (axisPara.IsActive && axisPara.Enabled) { double speed = 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; } if (softLimitEnabled) { if (dir == RotationDirection.CW) { MoveM(softLimitP, speed); } else { MoveM(softLimitN, speed); } } else { if (isAllowMove(dir)) { byte bDir; if (dir == RotationDirection.CW) { bDir = 0; } else { bDir = 1; } CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, MmToPulse(checkOverMaxSpeed(speed)) / 2, MmToPulse(checkOverMaxSpeed(speed)), axisPara.AccVelM, axisPara.DecVelM); CCMNet.CS_mnet_m1_v_move(RingNoOfMNet, axisPara.SlaveIP, Convert.ToByte(dir)); } } } }
/// <summary> /// 吋動 (自定義速度,初速為恆速1/2,加速度減速度為軸參手動設定) /// </summary> /// <param name="speed">速度值 (millimeter).</param> /// <param name="dir">吋動方向</param> public void JogM(double speed, RotationDirection dir) { if (axisPara.IsActive && axisPara.Enabled) { int i = MmToPulse(speed); if (!this.IsBusy) { CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM); } CCMNet.CS_mnet_m1_v_change(RingNoOfMNet, axisPara.SlaveIP, (double)i, 0.1); if (!this.IsBusy) { CCMNet.CS_mnet_m1_v_move(RingNoOfMNet, axisPara.SlaveIP, Convert.ToByte(dir)); } } }