private void LimitStatus() { //MCCL.MCC_EnableLimitSwitchCheck(); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.X, 0, 0, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.Y, 0, 1, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.Z, 0, 2, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.X, 1, 0, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.Y, 1, 1, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.Z, 1, 2, MCCL.CARDINDEX0); Debug.Print("limit-:" + PositiveLimitSwitchStatus.X.ToString()); if (PositiveLimitSwitchStatus.X != 0) { PB_LimitX.Image = Image.FromFile(Application.StartupPath + "\\Picture\\Limit_Light2.png"); Debug.Print("Y"); } else { PB_LimitX.Image = Image.FromFile(Application.StartupPath + "\\Picture\\Limit_Light.png"); Debug.Print("N"); } }
/// <summary> /// 從MCCL獲取資訊 /// </summary> /// <returns></returns> public static void GetMCCLData() { MCCL.MCC_GetCurRefPos(ref CurRefPos.X, ref CurRefPos.Y, ref CurRefPos.Z, ref CurRefPos.U, ref CurRefPos.V, ref CurRefPos.W, ref CurRefPos.A, ref CurRefPos.B, 0); MCCL.MCC_GetCurPos(ref CurPos.X, ref CurPos.Y, ref CurPos.Z, ref CurPos.U, ref CurPos.V, ref CurPos.W, ref CurPos.A, ref CurPos.B, 0); MCCL.MCC_GetSpeed(ref speed.X, ref speed.Y, ref speed.Z, ref speed.U, ref speed.V, ref speed.W, ref speed.A, ref speed.B, 0); MCCL.MCC_GetENCValue(ref ENCValue.X, 0, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.Y, 1, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.Z, 2, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.U, 3, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.V, 4, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.W, 5, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.A, 6, MCCL.CARDINDEX0); MCCL.MCC_GetENCValue(ref ENCValue.B, 7, MCCL.CARDINDEX0); MCCL.MCC_GetPulsePos(ref PulsePos.X, ref PulsePos.Y, ref PulsePos.Z, ref PulsePos.U, ref PulsePos.V, ref PulsePos.W, ref PulsePos.A, ref PulsePos.B, 0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.X, 0, 0, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.Y, 0, 1, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.Z, 0, 2, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.U, 0, 3, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.V, 0, 4, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.W, 0, 5, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.A, 0, 6, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref PositiveLimitSwitchStatus.B, 0, 7, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.X, 1, 0, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.Y, 1, 1, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.Z, 1, 2, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.U, 1, 3, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.V, 1, 4, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.W, 1, 5, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.A, 1, 6, MCCL.CARDINDEX0); MCCL.MCC_GetLimitSwitchStatus(ref NegativeLimitSwitchStatus.B, 1, 7, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.X, 0, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.Y, 1, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.Z, 2, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.U, 3, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.V, 4, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.W, 5, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.A, 6, MCCL.CARDINDEX0); MCCL.MCC_GetHomeSensorStatus(ref HomeSensorStatus.B, 7, MCCL.CARDINDEX0); //進給率 CurFeedSpeed = MCCL.MCC_GetCurFeedSpeed(0); MCCL.MCC_GetEmgcStopStatus(ref EmgcStopStatus, MCCL.CARDINDEX0); Error = MCCL.MCC_GetErrorCode(0).ToString(); //MCCL.MCC_GetErrorCount(); UpdateCoordinateSystem(); }