Beispiel #1
0
        public string button_DataSet_Click(object sender, EventArgs e)
        {
            string        resultStr = "DataSet OK";
            MC07_S_RESULT sResult   = new MC07_S_RESULT(0);
            ushort        Data      = 0;
            ushort        Cmd       = 0;
            uint          LData     = 0;
            string        errStr    = "";

            //*** FSPD SET COMMAND       : 5000Hz ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Cmd   = 0x5;
            LData = 5000;
            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);
            }

            //*** JSPD SET COMMAND       : 1000Hz ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Cmd   = 0xC;
            LData = 1000;
            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);
            }

            //*** HIGH SPEED SET COMMAND ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Data = 5000;                            // HSPD       : 5000Hz;
            if (MC07.BWDriveData1(hDev, ref Data, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveData1() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            Data = 0x3;                             // RESOL No.  : 3;
            if (MC07.BWDriveData2(hDev, ref Data, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveData2() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            Cmd = 0x6;
            if (MC07.BWDriveCommand(hDev, ref Cmd, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveCommand(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            //*** LOW SPEED SET COMMAND ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Data = 1000;                            // LSPD       : 1000Hz
            if (MC07.BWDriveData1(hDev, ref Data, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveData1() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            Data = 1000;                             // ELSPD      : 1000Hz
            if (MC07.BWDriveData2(hDev, ref Data, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveData2() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            Cmd = 0x7;
            if (MC07.BWDriveCommand(hDev, ref Cmd, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveCommand(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            //*** RATE SET COMMAND ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Data = 200;                            // UCYCLE     : 100μs
            if (MC07.BWDriveData1(hDev, ref Data, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveData1() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            Data = 200;                             // DCYCLE     : 100μs
            if (MC07.BWDriveData2(hDev, ref Data, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveData2() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            Cmd = 0x8;
            if (MC07.BWDriveCommand(hDev, ref Cmd, ref sResult) == false)
            {
                resultStr = "It failed in MC07.BWDriveCommand(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            //*** ORIGIN SPEC SET ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            if (MC07.SetOrgSpec(hDev, 0x8000, ref sResult) == false)
            {
                resultStr = "It failed in MC07.SetOrgSpec() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            //*** MARGIN PULSE            : 5 Pulse ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            if (MC07.SetOrgMarginPulse(hDev, 5, ref sResult) == false)
            {
                resultStr = "It failed in MC07.SetOrgMarginPulse() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(resultStr);
            }

            return(resultStr);
        }