예제 #1
0
        public void MotorMotionTest()
        {
            ushort pStatus   = 0;
            bool   resStatus = MC07.ReadOrgStatus(hDev, ref pStatus, ref sResult1);

            MC07_S_ORG_PARAM psOrgParam = new MC07_S_ORG_PARAM();

            bool resParam = MC07.ReadOrgParam(hDev, ref psOrgParam, ref sResult1);
        }
예제 #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);
        }