Пример #1
0
//        public string button_Rtn_Click(object sender, EventArgs e)
//        {
//			string resultStr = "Rtn OK";
//			string errStr = "";
//			MC07_S_RESULT sResult = new MC07_S_RESULT(0);
//            byte StopCode = 0;
//            ushort Cmd = 0;
//			uint LData = 0;
//
//			//*** ABSOLUTE INDEX DRIVE COMMAND ***
//			if (CheckStatus1(hDev, ref errStr) == false) return errStr;
//			Cmd = 0x15;
//			LData = 0;
//			if (MC07.LWDrive(hDev, Cmd, ref LData, ref sResult) == false){
//				resultStr = "It failed in MC07.LWDrive(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
//				return resultStr;
//			}
//            bool isResult = Ready_Wait( hDev, ref StopCode, false, ref errStr);
//            if(!isResult)
//            {
//				resultStr = errStr;
//			}
//			return resultStr;
//		}

        public string button_CcwIndex_Click(object sender, EventArgs e)
        {
            string        resultStr = "CcwIndex OK";
            string        errStr    = "";
            MC07_S_RESULT sResult   = new MC07_S_RESULT(0);
            byte          StopCode  = 0;
            ushort        Cmd       = 0;
            uint          LData     = 0;

            //*** INCREMENTAL INDEX DRIVE COMMAND ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Cmd   = 0x14;
            LData = MC07.Unsigned32(-10000);
            if (MC07.LWDrive(hDev, Cmd, ref LData, ref sResult) == false)
            {
                resultStr = "It failed in MC07.LWDrive(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }
            bool isResult = Ready_Wait(hDev, ref StopCode, false, ref errStr);

            if (!isResult)
            {
                resultStr = errStr;
            }
            return(resultStr);
        }
Пример #2
0
        public string StepDrive(int step, out bool isRes)
        {
            DisplayAddress();

            isRes = true;
            //移動後パルスチェック
            if (DataController.SETDATA.Origin[CcdF] == 1)
            {
                if ((gRData + step) < DataController.SETDATA.L_LimitPLS[CcdF] ||
                    (gRData + step) > DataController.SETDATA.U_LimitPLS[CcdF])
                {
                    isRes = false;
                    return("StepDrive Range Over Error");
                }
            }

            string        resultStr = "StepDrive OK";
            string        errStr    = "";
            MC07_S_RESULT sResult   = new MC07_S_RESULT(0);
            byte          StopCode  = 0;
            ushort        Cmd       = 0;
            uint          LData     = 0;

            //*** INCREMENTAL INDEX DRIVE COMMAND ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }

            Cmd = 0x14;

            if (step < 0)
            {
                LData = MC07.Unsigned32(step);
            }
            else
            {
                LData = (uint)step;
            }

            if (MC07.LWDrive(hDev, Cmd, ref LData, ref sResult) == false)
            {
                resultStr = "It failed in MC07.LWDrive(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }
            bool isResult = Ready_Wait(hDev, ref StopCode, false, ref errStr);

            if (!isResult)
            {
                resultStr = errStr;
            }
            return(resultStr);
        }