/// <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="dest">目標位置 (millimeter).</param> /// <param name="speed"> 速度值 </param> public void MoveM(double dest, double speed) { if (axisPara.IsActive && axisPara.Enabled) { CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, MmToPulse(speed) / 2, MmToPulse(speed), axisPara.AccVelM, axisPara.DecVelM); nPos = MmToPulse(dest); CCMNet.CS_mnet_m1_start_a_move(RingNoOfMNet, axisPara.SlaveIP, nPos); } }
/// <summary> /// 絕對移動 (需選擇使用軸參的手動速度或是自動速度) /// </summary> /// <param name="dest">目標位置 (millimeter).</param> /// <param name="inAuto">手動或自動速度</param> public void Move(double dest, SpeedMode inAuto) { if (axisPara.IsActive && axisPara.Enabled) { if (inAuto == SpeedMode.Manual) { CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, MmToPulse(axisPara.StrVelM), MmToPulse(axisPara.DevVelM), axisPara.AccVelM, axisPara.DecVelM); } if (inAuto == SpeedMode.Auto) { CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, MmToPulse(axisPara.StrVelA), MmToPulse(axisPara.DevVelA), axisPara.AccVelA, axisPara.DecVelA); } nPos = MmToPulse(dest); CCMNet.CS_mnet_m1_start_a_move(RingNoOfMNet, axisPara.SlaveIP, nPos); } }
/// <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)); } } }
private void doHomeLimWithZPhase() { CCMNet.CS_mnet_m1_set_home_config(RingNoOfMNet, axisPara.SlaveIP, 12, Convert.ToUInt16(axisPara.LogicORG), Convert.ToUInt16(axisPara.LogicZ), 0, 0); CCMNet.CS_mnet_m1_set_tmove_speed(RingNoOfMNet, axisPara.SlaveIP, 0, MmToPulse(axisPara.CreepDevVelH), axisPara.CreepAccVelH, axisPara.CreepDecVelH); CCMNet.CS_mnet_m1_start_home_move(RingNoOfMNet, axisPara.SlaveIP, 0); }