//상속된것들. public bool Init() { //통합 보드 초기화 부분. if (CAXL.AxlIsOpened() == 0) { // 통합 라이브러리가 사용 가능하지 (초기화가 되었는지) 확인 if (CAXL.AxlOpenNoReset(7) != 0) { // 통합 라이브러리 초기화 Log.ShowMessage("Dio", "AJIN AXL Lib Loading Error"); return(false); } } uint uiStatus = 0; uint uiRet = CAXD.AxdInfoIsDIOModule(ref uiStatus); if (uiRet != 0) { if (uiStatus == 0) { Log.ShowMessage("Dio", "AJIN AXL No Exist IO Module"); } else { Log.ShowMessage("Dio", "AJIN AXL Init Failed"); } return(false); } //모듈 정보 확인 부분. //InPut OutPut Count Set CAXD.AxdInfoGetModuleCount(ref m_iModuleCnt); //Get Max I Module , O Module Count. int iInputCnt = 0, iOutputCnt = 0; m_aModuleInfo = new TModuleInfo[m_iModuleCnt]; for (int i = 0; i < m_iModuleCnt; i++) { CAXD.AxdInfoGetInputCount(i, ref iInputCnt); CAXD.AxdInfoGetOutputCount(i, ref iOutputCnt); m_iMaxIn += iInputCnt; m_iMaxOut += iOutputCnt; m_aModuleInfo[i].iCntIn = iInputCnt; m_aModuleInfo[i].iCntOut = iOutputCnt; //m_aModuleInfo[i].uData = 0 ; } return(true); }
private void InitializeDIO() { UInt32 retValue = 0; // DIO 모듈 존재여부 확인 Validate(CAXD.AxdInfoIsDIOModule(ref retValue)); if (retValue == (UInt32)AXT_EXISTENCE.STATUS_EXIST) { int moduleCount = 0; Validate(CAXD.AxdInfoGetModuleCount(ref moduleCount)); for (int i = 0; i < moduleCount; i++) { int channelCount = 0; // DI 채널 개수 확인 Validate(CAXD.AxdInfoGetInputCount(i, ref channelCount)); if (channelCount > 0) { for (int j = 0; j < channelCount / 16; j++) { AxtDioWordModule module = new AxtDioWordModule(i, j); DI.AddModule(module); } } // DO 채널 개수 확인 Validate(CAXD.AxdInfoGetOutputCount(i, ref channelCount)); if (channelCount > 0) { for (int j = 0; j < channelCount / 16; j++) { AxtDioWordModule module = new AxtDioWordModule(i, j); DO.AddModule(module); } } } DI.Initialize(); DO.Initialize(); Read(); } }
public void InitDIO() { try { // Initialize library uint result = CAXL.AxlOpen(7); if (result == (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS || result == (uint)AXT_FUNC_RESULT.AXT_RT_OPEN_ALREADY) { uint uStatus = 0; if (CAXD.AxdInfoIsDIOModule(ref uStatus) == (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { if ((AXT_EXISTENCE)uStatus == AXT_EXISTENCE.STATUS_EXIST) { int nModuleCount = 0; if (CAXD.AxdInfoGetModuleCount(ref nModuleCount) == (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { short i = 0; int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; string strData = ""; for (i = 0; i < nModuleCount; i++) { if (CAXD.AxdInfoGetModule(i, ref nBoardNo, ref nModulePos, ref uModuleID) == (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_RDI32MLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-DI32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDI32MSMLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDI32PMLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-DB32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDI32RTEX: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DI32_P: strData = String.Format("[{0:D2}:{1:D2}] SIO-DB32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDI32: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDI32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DI32: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDO32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO32MLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDB128MLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO32AMSMLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RSIMPLEIOMLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO32PMLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDO16AMLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO16AMLII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDO16BMLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO16BMLII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDB96MLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO32RTEX: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDO32RTEX", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32T_P: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDI32RTEX", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDO32: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDB32RTEX", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32P: strData = String.Format("[{0:D2}:{1:D2}] SIO-DI32_P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32T: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32T_P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB32MLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDB32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB32PMLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-DI32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB128MLIIIAI: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB96MLII: strData = String.Format("[{0:D2}:{1:D2}] SIO-DB32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB32RTEX: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB128MLII: strData = String.Format("[{0:D2}:{1:D2}] SIO-DB32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DB32P: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDI32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB32T: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDO32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DB32T: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDB128MLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_UNDEFINEMLIII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RSIMPLEIOMLII", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RSIMPLEIOMLII: strData = String.Format("[{0:D2}:{1:D2}] SIO-RDO16AMLII", nBoardNo, i); break; } int inpCnt = 0, outCnt = 0; CAXD.AxdInfoGetInputCount(i, ref inpCnt); CAXD.AxdInfoGetOutputCount(i, ref outCnt); int inStartIndex = m_nInputCount; int outStartIndex = m_nOutputCount; m_nInputCount += inpCnt; m_nOutputCount += outCnt; int inEndIndex = m_nInputCount - 1; int outEndIndex = m_nOutputCount - 1; switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_DB32P: case AXT_MODULE.AXT_SIO_RDB32T: case AXT_MODULE.AXT_SIO_DB32T: case AXT_MODULE.AXT_SIO_UNDEFINEMLIII: { outStartIndex += 16; outEndIndex += 16; } break; } ModuleInfo modInfo = new ModuleInfo(i, strData, inpCnt, outCnt, uModuleID, "none", inStartIndex, inEndIndex, outStartIndex, outEndIndex); m_listModules.Add(modInfo); } } m_nModuleCount = nModuleCount; } } } } m_listInNames = new List <string>(m_nInputCount); for (int i = 0; i < m_nInputCount; i++) { m_listInNames.Add(""); } m_listOutNames = new List <string>(m_nOutputCount); for (int i = 0; i < m_nOutputCount; i++) { m_listOutNames.Add(""); } } catch (Exception E) { throw E; } }