| | |
| | | // 设置点位模式运动参数 |
| | | sRtn = GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, (short)movingOption.AxisIndex, ref trapPrm); |
| | | // 设置点位模式目标速度,即回原点速度 |
| | | sRtn = GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)movingOption.AxisIndex, goHomePara.HighVelocity); |
| | | sRtn = GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)movingOption.AxisIndex, goHomePara.HomeVelocity); |
| | | |
| | | do |
| | | { |
| | | PositionReset(movingOption.AxisIndex, 1); |
| | | ClearStatus(movingOption.AxisIndex, 1); |
| | | |
| | | if (goHomePara.IsCaptureMode) |
| | | { |
| | | //搜索距离 阶段1 |
| | | // 启动Home捕获 |
| | | sRtn = GTSCardAPI.GT_SetCaptureMode((short)IConfig.CardNum, (short)movingOption.AxisIndex, GTSCardAPI.CAPTURE_HOME); |
| | | } |
| | | |
| | | // 设置点位模式目标位置,即原点搜索距离 |
| | | sRtn = GTSCardAPI.GT_SetPos((short)IConfig.CardNum, (short)movingOption.AxisIndex, homeDirection ? 99999999 : -99999999); |
| | |
| | | int repeatTime = goHomePara.GoHomeTimeOut * 1000; |
| | | |
| | | bool isStop = false; |
| | | int pos; |
| | | int pos = 0; |
| | | uint clk;//时钟参数 |
| | | |
| | | int checkInterval = IConfig.MonitorInterval; |
| | | if (IConfig.MonitorInterval <= 0) |
| | | { |
| | | checkInterval = 10; |
| | | } |
| | | |
| | | do |
| | | { |
| | | Thread.Sleep(IConfig.MonitorInterval * 5); |
| | | Thread.Sleep(checkInterval * 2); |
| | | |
| | | if (goHomePara.IsCaptureMode) |
| | | { |
| | | // 读取捕获状态 |
| | | GTSCardAPI.GT_GetCaptureStatus((short)IConfig.CardNum, (short)movingOption.AxisIndex, out capture, out pos, 1, out clk); |
| | | } |
| | | else |
| | | { |
| | | GTSCardAPI.GT_GetDi((short)IConfig.CardNum, GTSCardAPI.MC_HOME, out int pValue); |
| | | |
| | | capture = (short)((pValue & (1 << (movingOption.AxisIndex - 1))) == 0 ? 1 : 0); |
| | | } |
| | | isStop = IsStop((short)movingOption.AxisIndex); |
| | | repeatTime -= IConfig.MonitorInterval * 5; |
| | | repeatTime -= checkInterval * 2; |
| | | } while (!(isStop || capture == 1 || repeatTime <= 0)); |
| | | |
| | | if (repeatTime <= 0) |