| | |
| | | repeatTime = 1000; |
| | | do |
| | | { |
| | | isStop = IsStop((short)IConfig.CardNum, (short)optionPara.AxisIndex); |
| | | isStop = IsStop((short)optionPara.AxisIndex); |
| | | Thread.Sleep(50); |
| | | repeatTime--; |
| | | } while (!isStop && repeatTime > 0); |
| | |
| | | repeatTime = 1000; |
| | | do |
| | | { |
| | | isStop = IsStop((short)IConfig.CardNum, (short)optionPara.AxisIndex); |
| | | isStop = IsStop((short)optionPara.AxisIndex); |
| | | Thread.Sleep(50); |
| | | repeatTime--; |
| | | } while (!isStop && repeatTime > 0); |
| | |
| | | int repeatTime = 100; |
| | | do |
| | | { |
| | | isStop = IsStop((short)IConfig.CardNum, (short)axisNum); |
| | | isStop = IsStop((short)axisNum); |
| | | Thread.Sleep(10); |
| | | repeatTime--; |
| | | } while (!isStop && repeatTime > 0); |
| | |
| | | /// <param name="cardNum">板卡号</param> |
| | | /// <param name="axisNum">轴号</param> |
| | | /// <returns></returns> |
| | | public bool IsStop(short cardNum, short axisNum) |
| | | public bool IsStop(short axisNum) |
| | | { |
| | | int sts = GetAxisStatus(axisNum); |
| | | if ((sts & 0x400) == 0) return true;//停止返回true |
| | | else return false; //运行中返回false |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取轴状态 |
| | | /// </summary> |
| | | /// <param name="cardNum">板卡号</param> |
| | | /// <param name="axisNum">轴号</param> |
| | | /// <returns></returns> |
| | | public int GetAxisStatus(int axisNum) |
| | | { |
| | | lock (moveLock) |
| | | { |
| | | int sts = 0; |
| | | uint pclock = 0; |
| | | GTSCardAPI.GT_GetSts(cardNum, axisNum, out sts, 1, out pclock); |
| | | if ((sts & 0x400) == 0) return true;//停止返回true |
| | | else return false; //运行中返回false |
| | | GTSCardAPI.GT_GetSts((short)IConfig.CardNum, (short)axisNum, out sts, 1, out pclock); |
| | | return sts; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region IMonitor |
| | |
| | | axisMovingStatus.Destination = Convert.ToInt32(GetPrfPosition(axisMovingStatus.AxisIndex)); |
| | | axisMovingStatus.CurVelocity = GetVelocity(axisMovingStatus.AxisIndex); |
| | | axisMovingStatus.PrfVelocity = GetPrfVelocity(axisMovingStatus.AxisIndex); |
| | | axisMovingStatus.AxisStatus = GetAxisStatus(axisMovingStatus.AxisIndex); |
| | | |
| | | axisMovingStatusesList.Add(axisMovingStatus); |
| | | |
| | | } |
| | |
| | | public override void ResetAlarm() |
| | | { |
| | | int axis_sts; |
| | | uint clk; |
| | | var axisSettings = IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled); |
| | | GTSCardAPI.GT_ClrSts((short)IConfig.CardNum, 1, (short)axisSettings.Count); |
| | | foreach (var axisSetting in axisSettings) |
| | | { |
| | | GTSCardAPI.GT_GetSts((short)IConfig.CardNum, (short)axisSetting.AxisIndex, out axis_sts, 1, out clk); |
| | | axis_sts = GetAxisStatus((short)axisSetting.AxisIndex); |
| | | if ((axis_sts & 0x200) == 0) |
| | | { |
| | | var rst = GTSCardAPI.GT_AxisOn((short)IConfig.CardNum, (short)axisSetting.AxisIndex); |