Ejemplo n.º 1
0
        public string button_CwScan_Click(object sender, EventArgs e)
        {
            string        resultStr = "CwScan OK";
            MC07_S_RESULT sResult   = new MC07_S_RESULT(0);
            ushort        Cmd       = 0;
            byte          StopCode  = 0;
            string        errStr    = "";

            //*** +CW SCAN DRIVE COMMAND ***
            if (CheckStatus1(hDev, ref errStr) == false)
            {
                return(errStr);
            }
            Cmd = 0x12;
            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);
            }
            bool isResult = Ready_Wait(hDev, ref StopCode, false, ref errStr);

            if (!isResult)
            {
                resultStr = errStr;
            }
            return(resultStr);
        }
Ejemplo n.º 2
0
        public string button_SlowStop_Click(object sender, EventArgs e)
        {
            string        resultStr = "SlowStop OK";
            MC07_S_RESULT sResult   = new MC07_S_RESULT(0);
            ushort        Cmd       = 0;

            //*** SLOW STOP COMMAND ***
            Cmd = 0xFE;
            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);
        }
Ejemplo n.º 3
0
        private Boolean CheckStatus1(uint hDevice, ref string errStr)
        {
            MC07_S_RESULT sResult = new MC07_S_RESULT(0);
            ushort        Cmd     = 0;
            ushort        Status1 = 0;
            ushort        Data1   = 0;

            //*** CHECK STATUS1 BUSY BIT = 0 (WAIT TIME = 1000ms)***
            if (MC07.BWaitDriveCommand(hDevice, 1000, ref sResult) == false)
            {
                errStr = "It failed in MC07.BWaitDriveCommand() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(false);
            }

            //*** READ STATUS1 ***
            if (MC07.BRStatus1(hDevice, ref Status1, ref sResult) == false)
            {
                errStr = "It failed in MC07.BRStatus1() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                return(false);
            }

            //*** CHECK STATUS1 ERROR BIT = 0 ***
            if ((Status1 & 0x0010) != 0)
            {
                //*** READ ERROR STATUS ***
                Cmd = 0xD1;
                if (MC07.BWDriveCommand(hDevice, ref Cmd, ref sResult) == false)
                {
                    errStr = "It failed in MC07.BWDriveCommand(H'" + Cmd.ToString("X") + ") : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                    return(false);
                }

                if (MC07.BRDriveData1(hDevice, ref Data1, ref sResult) == false)
                {
                    errStr = "It failed in MC07.BRDriveData1(): MC07.Result(1) = " + sResult.MC07_Result[1].ToString();
                    return(false);
                }

                errStr = "STATUS1 ERROR = 1 : ERROR STATUS = H'" + Data1.ToString("X") + "\r\n Please click 'Clear Error'";

                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
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);
        }