Beispiel #1
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);
        }
Beispiel #2
0
        private bool Ready_Wait(uint hDevice, ref byte StopCode, bool OriginDriveFlag, ref string errStr)
        {
            MC07_S_RESULT sResult = new MC07_S_RESULT(0);
            ushort        Status1 = 0;

            do
            {
//				Now_Address_Display( hDevice );
                Application.DoEvents();
//				Now_Address_Display( hDevice );
                if (MC07.BRStatus1(hDevice, ref Status1, ref sResult) == false)
                {
                    errStr   = "It failed in MC07.BRStatus1() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                    StopCode = 7;
                    return(false);
                }
            }while((Status1 & 0x0001) != 0);

//            Now_Address_Display( hDevice );

            if (OriginDriveFlag)
            {
                if (MC07.ReadOrgStatus(hDevice, ref Status1, ref sResult) == false)
                {
                    errStr   = "It failed in MC07.ReadOrgStatus() : MC07.Result(1)=" + sResult.MC07_Result[1].ToString();
                    StopCode = 7;
                    return(false);
                }
                if ((Status1 & 0x8000) != 0)
                {
                    StopCode = 6;                                            // ADDRESS ERROR
                }
                else if ((Status1 & 0x4000) != 0)
                {
                    StopCode = 5;                                            // ERROR PULSE ERROR
                }
                else if ((Status1 & 0x2000) != 0)
                {
                    StopCode = 4;                                            // SENSOR ERROR
                }
                else if ((Status1 & 0x0020) != 0)
                {
                    StopCode = 3;                                            // LSEND
                }
                else if ((Status1 & 0x0040) != 0)
                {
                    StopCode = 2;                                            // SSEND
                }
                else if ((Status1 & 0x0080) != 0)
                {
                    StopCode = 1;                                            // FSEND
                }
                else
                {
                    StopCode = 0;                                            // PASS
                }
            }
            else
            {
                if ((Status1 & 0x0020) != 0)
                {
                    StopCode = 3;                                            // LSEND
                }
                else if ((Status1 & 0x0040) != 0)
                {
                    StopCode = 2;                                            // SSEND
                }
                else if ((Status1 & 0x0080) != 0)
                {
                    StopCode = 1;                                            // FSEND
                }
                else
                {
                    StopCode = 0;                                            // PASS
                }
            }
            return(true);
        }