public void Release() { #if false MC07_S_RESULT sResult = new MC07_S_RESULT(0); Boolean Ret = false; Ret = MC07.BClose(hDev, ref sResult); Ret = MC07.UWExUnitCommControl(hUnit, MC07.MC07_EX_UNIT_COMM_STOP, ref sResult); Ret = MC07.UClose(hUnit, ref sResult); Ret = MC07.BPortClose(hInPort, ref sResult); Ret = MC07.BPortClose(hOutPort, ref sResult); #endif }
public void LedLightOff() //LED消灯 { //*** UNIT OPEN *** MC07.UOpen(MC07.MC07_USB_UNIT_0, ref hUnit, ref sResult1); //*** UNIT COMMUNICATION MODE *** MC07.UWExUnitCommMode(hUnit, MC07.MC07_EX_UNIT_COMM_RATE_5, 1, MC07.MC07_EX_UNIT_COMM_16BIT, ref sResult1); //*** UNIT COMMUNICATION CONTROL *** MC07.UWExUnitCommControl(hUnit, MC07.MC07_EX_UNIT_COMM_START, ref sResult1); Thread.Sleep(20); //*** BPORT OPEN *** MC07.BPortOpen(MC07.MC07_USB_UNIT_0, MC07.MC07_EXP0_OUT, ref hPort, ref sResult1); //*** BPORT WRITE *** pData = 0x02; MC07.BPortOut(hPort, ref pData, ref sResult1); //*** BPORT CLOSE *** MC07.BPortClose(hPort, ref sResult1); }
public int M_NgBoxCheck() { bool result = false; string resultStr = ""; // ushort extUnitStatus = 0; //*** UNIT OPEN *** result = MC07.UOpen(MC07.MC07_USB_UNIT_0, ref hUnit, ref sResult1); if (!result) { resultStr = "It failed in MC07.UOpen() : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); } //*** UNIT COMMUNICATION MODE *** result = MC07.UWExUnitCommMode(hUnit, MC07.MC07_EX_UNIT_COMM_RATE_5, 1, MC07.MC07_EX_UNIT_COMM_16BIT, ref sResult1); if (!result) { resultStr = "It failed in MC07.UWExUnitCommMode() : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); } //*** UNIT COMMUNICATION CONTROL *** result = MC07.UWExUnitCommControl(hUnit, MC07.MC07_EX_UNIT_COMM_START, ref sResult1); if (!result) { resultStr = "It failed in MC07.UWExUnitCommControl(START) \r\n : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); } //*** WAIT CONNECT BIT = 1 *** // do // { // //*** READ UNIT COMMUNICATION STATUS *** // if (MC07.URExUnitCommStatus(hUnit, ref extUnitStatus, ref sResult1) == false) // { // resultStr = "It failed in MC07.URExUnitCommStatus() : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); // //Because it is avoided double Unit Open Error // MC07.UClose(hUnit,ref sResult1); // } // // //*** CHECK POLLING BIT *** // if ((extUnitStatus & 0x1) == 0) // { // resultStr = "EXTEND UNIT STATUS is not Polling. \r\nPlease Check EXTEND UNIT connection"; // //Because it is avoided double Unit Open Error // MC07.UClose(hUnit,ref sResult1); // } // // //*** CHECK DISCONNECT LATCH BIT *** // if ((extUnitStatus & 0x4) !=0) // { // resultStr = "EXTEND UNIT STATUS is DISCONNECT LATCH. \r\n Please Check EXTEND UNIT connection"; // // //*** UNIT COMMUNICATION CONTROL *** // if (MC07.UWExUnitCommControl(hUnit, MC07.MC07_EX_UNIT_COMM_DISC_LATCH_CLR,ref sResult1) == false) // { // resultStr = "It failed in MC07.UWExUnitCommControl(LATCH_CLR) \r\n : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); // //Because it is avoided double Unit Open Error // MC07.UClose(hUnit,ref sResult1); // } // // //Because it is avoided double Unit Open Error // MC07.UClose(hUnit,ref sResult1); // } // //*** CHECK CONNECT BIT *** // }while((extUnitStatus & 0x2) == 0); // //*** BPORT OPEN *** result = MC07.BPortOpen(MC07.MC07_USB_UNIT_0, MC07.MC07_EXP0_IN, ref hPort, ref sResult1); if (!result) { resultStr = "It failed in MC07.BPortOpen() : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); } //*** BPORT READ *** pData = 0; result = MC07.BPortIn(hPort, ref pData, ref sResult1); if (!result) { resultStr = "It failed in MC07.BPortIn() : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); } //*** BPORT CLOSE *** result = MC07.BPortClose(hPort, ref sResult1); if (!result) { resultStr = "It failed in MC07.BPortClose() : MC07.Result(1)=" + sResult1.MC07_Result[1].ToString(); } short retData = (short)pData; retData &= 0x0100; retData >>= 8; return(retData); }