private bool SelectLowIndex(int nIndex, uint uValue) { int nModuleCount = 0; CAXD.AxdInfoGetModuleCount(ref nModuleCount); if (nModuleCount > 0) { int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; CAXD.AxdInfoGetModule(comboModule.SelectedIndex, ref nBoardNo, ref nModulePos, ref uModuleID); switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_DO32P: case AXT_MODULE.AXT_SIO_DO32T: case AXT_MODULE.AXT_SIO_RDO32: CAXD.AxdoWriteOutportBit(comboModule.SelectedIndex, nIndex + 16, uValue); break; case AXT_MODULE.AXT_SIO_DB32P: case AXT_MODULE.AXT_SIO_DB32T: case AXT_MODULE.AXT_SIO_RDB128MLII: CAXD.AxdoWriteOutportBit(comboModule.SelectedIndex, nIndex, uValue); break; default: return(false); } } return(true); }
public bool[] readOutput_Map() { short nIndex = 0; uint uDataHigh = 0, uDataLow = 0, uFlagHigh = 0, uFlagLow = 0, uModuleID = 0; int nBoardNo = 0, nModulePos = 0; int boolArrayQuentity = this.m_Otp_Module_Quentity * 32; bool[] m_bReadResultIOMap = new bool[boolArrayQuentity]; for (int moduleNo = 0; moduleNo < this.m_Otp_Module_Quentity; moduleNo++) { CAXD.AxdInfoGetModule(moduleNo + 3, ref nBoardNo, ref nModulePos, ref uModuleID); CAXD.AxdoReadOutportWord(moduleNo + 3, 0, ref uDataHigh); CAXD.AxdoReadOutportWord(moduleNo + 3, 1, ref uDataLow); for (nIndex = 0; nIndex < 16; nIndex++) { int wIndex = nIndex + 32 * moduleNo; // Verify the last bit value of data read uFlagHigh = uDataHigh & 0x0001; uFlagLow = uDataLow & 0x0001; // Shift rightward by bit by bit uDataHigh = uDataHigh >> 1; uDataLow = uDataLow >> 1; // Updat bit value in control if (uFlagHigh == 1) { m_bReadResultIOMap[wIndex] = true; } else { m_bReadResultIOMap[wIndex] = false; } if (uFlagLow == 1) { m_bReadResultIOMap[wIndex + 16] = true; } else { m_bReadResultIOMap[wIndex + 16] = false; } } } return(m_bReadResultIOMap); }
private void checkFallingEdge_CheckedChanged(object sender, System.EventArgs e) { int nModuleCount = 0; CAXD.AxdInfoGetModuleCount(ref nModuleCount); if (nModuleCount > 0) { int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; CAXD.AxdInfoGetModule(comboModule.SelectedIndex, ref nBoardNo, ref nModulePos, ref uModuleID); switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_DI32: if (checkFallingEdge.Checked) { CAXD.AxdiInterruptEdgeSetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.DOWN_EDGE, 0xFFFF); CAXD.AxdiInterruptEdgeSetWord(comboModule.SelectedIndex, 1, (uint)AXT_DIO_EDGE.DOWN_EDGE, 0xFFFF); } else { CAXD.AxdiInterruptEdgeSetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.DOWN_EDGE, 0x0000); CAXD.AxdiInterruptEdgeSetWord(comboModule.SelectedIndex, 1, (uint)AXT_DIO_EDGE.DOWN_EDGE, 0x0000); } break; case AXT_MODULE.AXT_SIO_DB32P: case AXT_MODULE.AXT_SIO_DB32T: if (checkFallingEdge.Checked) { CAXD.AxdiInterruptEdgeSetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.DOWN_EDGE, 0xFFFF); } else { CAXD.AxdiInterruptEdgeSetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.DOWN_EDGE, 0x0000); } break; } } }
private void checkInterrupt_CheckedChanged(object sender, System.EventArgs e) { int nModuleCount = 0; CAXD.AxdInfoGetModuleCount(ref nModuleCount); if (nModuleCount > 0) { int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; CAXD.AxdInfoGetModule(comboModule.SelectedIndex, ref nBoardNo, ref nModulePos, ref uModuleID); switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_DI32: case AXT_MODULE.AXT_SIO_DB32P: case AXT_MODULE.AXT_SIO_DB32T: if (checkInterrupt.Checked) { CAXL.AxlInterruptEnable(); CAXD.AxdiInterruptSetModuleEnable(comboModule.SelectedIndex, (uint)AXT_USE.ENABLE); } else { IntPtr pEvent = (IntPtr)0; CAXD.AxdiInterruptSetModuleEnable(comboModule.SelectedIndex, (uint)AXT_USE.DISABLE); CAXL.AxlInterruptDisable(); } break; case AXT_MODULE.AXT_SIO_DO32P: case AXT_MODULE.AXT_SIO_DO32T: case AXT_MODULE.AXT_SIO_RDB128MLII: checkInterrupt.Checked = false; break; } } }
private bool DigitalIO_Open() { 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_DI32: strData = String.Format("[{0:D2}:{1:D2}] SIO-DI32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32P: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DB32P: strData = String.Format("[{0:D2}:{1:D2}] SIO-DB32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32T: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DB32T: 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_RDO32: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDO32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB128MLII: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDO32", nBoardNo, i); break; } m_alDioModuleList.Add(strData); } } } } } else { msgBox.ShowMessage("아젠 보드", "아젠 보드 DIO 모듈", "Module not exist."); return(false); } return(true); }
private void Threading_Timer() { short nIndex = 0; uint uDataHigh = 0; uint uDataLow = 0; uint uFlagHigh = 0; uint uFlagLow = 0; int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; CAXD.AxdInfoGetModule(comboModule.SelectedIndex, ref nBoardNo, ref nModulePos, ref uModuleID); switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_DI32: case AXT_MODULE.AXT_SIO_RDI32: //++ // Read inputting signal in WORD CAXD.AxdiReadInportWord(comboModule.SelectedIndex, 0, ref uDataHigh); CAXD.AxdiReadInportWord(comboModule.SelectedIndex, 1, ref uDataLow); for (nIndex = 0; nIndex < 16; nIndex++) { // Verify the last bit value of data read uFlagHigh = uDataHigh & 0x0001; uFlagLow = uDataLow & 0x0001; // Shift rightward by bit by bit uDataHigh = uDataHigh >> 1; uDataLow = uDataLow >> 1; // Updat bit value in control if (uFlagHigh == 1) { checkHigh[nIndex].Checked = true; } else { checkHigh[nIndex].Checked = false; } if (uFlagLow == 1) { checkLow[nIndex].Checked = true; } else { checkLow[nIndex].Checked = false; } } break; case AXT_MODULE.AXT_SIO_DB32P: case AXT_MODULE.AXT_SIO_DB32T: //++ // Read inputting signal in WORD CAXD.AxdiReadInportWord(comboModule.SelectedIndex, 0, ref uDataHigh); for (nIndex = 0; nIndex < 16; nIndex++) { // Verify the last bit value of data read uFlagHigh = uDataHigh & 0x0001; // Shift rightward by bit by bit uDataHigh = uDataHigh >> 1; // Updat bit value in control if (uFlagHigh == 1) { checkHigh[nIndex].Checked = true; } else { checkHigh[nIndex].Checked = false; } } break; } }
private bool OpenDevice() { //++ // Initialize library if (CAXL.AxlOpen(7) == (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { 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_DI32: strData = String.Format("[{0:D2}:{1:D2}] SIO-DI32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32P: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DB32P: strData = String.Format("[{0:D2}:{1:D2}] SIO-DB32P", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DO32T: strData = String.Format("[{0:D2}:{1:D2}] SIO-DO32T", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_DB32T: 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_RDO32: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDO32", nBoardNo, i); break; case AXT_MODULE.AXT_SIO_RDB128MLII: strData = String.Format("[{0:D2}:{1:D2}] SIO_RDO32", nBoardNo, i); break; } //comboModule.Items.Add(strData); } } //comboModule.SelectedIndex = 0; } } else { MessageBox.Show("Module not exist."); return(false); } } } else { MessageBox.Show("Open Error!"); } return(true); }
private bool SelectModule() { int nModuleCount = 0; CAXD.AxdInfoGetModuleCount(ref nModuleCount); if (nModuleCount > 0) { int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; short nIndex = 0; uint uDataHigh = 0; uint uDataLow = 0; uint uFlagHigh = 0; uint uFlagLow = 0; uint uUse = 0; CAXD.AxdInfoGetModule(comboModule.SelectedIndex, ref nBoardNo, ref nModulePos, ref uModuleID); switch ((AXT_MODULE)uModuleID) { case AXT_MODULE.AXT_SIO_DI32: case AXT_MODULE.AXT_SIO_RDI32: groupHigh.Text = "INPUT 0bit ~ 15Bit"; groupLow.Text = "INPUT 16bit ~ 31Bit"; if (((AXT_MODULE)uModuleID) == AXT_MODULE.AXT_SIO_RDI32) { checkInterrupt.Checked = false; radioCallback.Enabled = false; radioMessage.Enabled = false; radioEvent.Enabled = false; checkRigingEdge.Checked = false; checkFallingEdge.Checked = false; } else { checkInterrupt.Checked = true; radioCallback.Enabled = true; radioMessage.Enabled = true; radioEvent.Enabled = true; checkRigingEdge.Checked = true; checkFallingEdge.Checked = true; CAXD.AxdiInterruptGetModuleEnable(comboModule.SelectedIndex, ref uUse); if (uUse == (uint)AXT_USE.ENABLE) { checkInterrupt.Checked = true; SelectMessage(); } else { checkInterrupt.Checked = false; } CAXD.AxdiInterruptEdgeGetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.UP_EDGE, ref uDataHigh); CAXD.AxdiInterruptEdgeGetWord(comboModule.SelectedIndex, 1, (uint)AXT_DIO_EDGE.UP_EDGE, ref uDataLow); if (uDataHigh == 0xFFFF && uDataLow == 0xFFFF) { checkRigingEdge.Checked = true; } else { checkRigingEdge.Checked = false; } CAXD.AxdiInterruptEdgeGetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.DOWN_EDGE, ref uDataHigh); CAXD.AxdiInterruptEdgeGetWord(comboModule.SelectedIndex, 1, (uint)AXT_DIO_EDGE.DOWN_EDGE, ref uDataLow); if (uDataHigh == 0xFFFF && uDataLow == 0xFFFF) { checkFallingEdge.Checked = true; } else { checkFallingEdge.Checked = false; } } for (nIndex = 0; nIndex < 16; nIndex++) { checkHigh[nIndex].Text = String.Format("{0:D2}", nIndex); checkLow[nIndex].Text = String.Format("{0:D2}", nIndex + 16); } break; case AXT_MODULE.AXT_SIO_DO32P: case AXT_MODULE.AXT_SIO_DO32T: case AXT_MODULE.AXT_SIO_RDO32: groupHigh.Text = "OUTPUT 0bit ~ 15Bit"; groupLow.Text = "OUTPUT 16bit ~ 31Bit"; checkInterrupt.Checked = false; radioCallback.Enabled = false; radioMessage.Enabled = false; radioEvent.Enabled = false; checkRigingEdge.Checked = false; checkFallingEdge.Checked = false; //++ // Read outputting signal in WORD CAXD.AxdoReadOutportWord(comboModule.SelectedIndex, 0, ref uDataHigh); CAXD.AxdoReadOutportWord(comboModule.SelectedIndex, 1, ref uDataLow); for (nIndex = 0; nIndex < 16; nIndex++) { // Verify the last bit value of data read uFlagHigh = uDataHigh & 0x0001; uFlagLow = uDataLow & 0x0001; // Shift rightward by bit by bit uDataHigh = uDataHigh >> 1; uDataLow = uDataLow >> 1; // Updat bit value in control if (uFlagHigh == 1) { checkHigh[nIndex].Checked = true; } else { checkHigh[nIndex].Checked = false; } if (uFlagLow == 1) { checkLow[nIndex].Checked = true; } else { checkLow[nIndex].Checked = false; } checkHigh[nIndex].Text = String.Format("{0:D2}", nIndex); checkLow[nIndex].Text = String.Format("{0:D2}", nIndex + 16); } break; case AXT_MODULE.AXT_SIO_DB32P: case AXT_MODULE.AXT_SIO_DB32T: case AXT_MODULE.AXT_SIO_RDB128MLII: groupHigh.Text = "INPUT 0bit ~ 15Bit"; groupLow.Text = "OUTPUT 0bit ~ 15Bit"; // Only Digital Input was used checkInterrupt.Enabled = true; checkRigingEdge.Enabled = true; checkFallingEdge.Enabled = true; CAXD.AxdiInterruptGetModuleEnable(comboModule.SelectedIndex, ref uUse); if (uUse == (uint)AXT_USE.ENABLE) { checkInterrupt.Checked = true; SelectMessage(); } else { checkInterrupt.Checked = false; } CAXD.AxdiInterruptEdgeGetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.UP_EDGE, ref uDataHigh); if (uDataHigh == 0xFFFF) { checkRigingEdge.Checked = true; } else { checkRigingEdge.Checked = false; } CAXD.AxdiInterruptEdgeGetWord(comboModule.SelectedIndex, 0, (uint)AXT_DIO_EDGE.DOWN_EDGE, ref uDataHigh); if (uDataHigh == 0xFFFF) { checkFallingEdge.Checked = true; } else { checkFallingEdge.Checked = false; } //++ // Read outputting signal in WORD CAXD.AxdoReadOutportWord(comboModule.SelectedIndex, 0, ref uDataLow); for (nIndex = 0; nIndex < 16; nIndex++) { // Verify the last bit value of data read uFlagLow = uDataLow & 0x0001; // Shift rightward by bit by bit uDataLow = uDataLow >> 1; // Updat bit value in control if (uFlagLow == 1) { checkLow[nIndex].Checked = true; } else { checkLow[nIndex].Checked = false; } checkHigh[nIndex].Text = String.Format("{0:D2}", nIndex); checkLow[nIndex].Text = String.Format("{0:D2}", nIndex); } break; } } return(true); }
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; } }
public void activate(AXT_MODULE sub1, AXT_MODULE sub2, AXT_MODULE sub3, AXT_MODULE sub4, out bool b, out string s) { try { if (dev.NotExistHW.AXT) { b = true; s = "OK"; return; } isActivate = false; try { CAXL.AxlClose(); } catch { b = false; s = "Cannot find AXL.DLL"; return; } int lIrqNo = 19; uint uStatus = 0; int nDIOModule = 0; int nAIOModule = 0; DI_ModulCount = 0; DO_ModulCount = 0; AIO_ModulCount = 0; if (sub1 == AXT_MODULE.AXT_SIO_DI32) { DI_ModulCount++; } if (sub2 == AXT_MODULE.AXT_SIO_DI32) { DI_ModulCount++; } if (sub3 == AXT_MODULE.AXT_SIO_DI32) { DI_ModulCount++; } if (sub4 == AXT_MODULE.AXT_SIO_DI32) { DI_ModulCount++; } if (sub1 == AXT_MODULE.AXT_SIO_DO32P) { DO_ModulCount++; } if (sub2 == AXT_MODULE.AXT_SIO_DO32P) { DO_ModulCount++; } if (sub3 == AXT_MODULE.AXT_SIO_DO32P) { DO_ModulCount++; } if (sub4 == AXT_MODULE.AXT_SIO_DO32P) { DO_ModulCount++; } if (sub1 == AXT_MODULE.AXT_SIO_AI8AO4HB) { AIO_ModulCount++; } if (sub2 == AXT_MODULE.AXT_SIO_AI8AO4HB) { AIO_ModulCount++; } if (sub3 == AXT_MODULE.AXT_SIO_AI8AO4HB) { AIO_ModulCount++; } if (sub4 == AXT_MODULE.AXT_SIO_AI8AO4HB) { AIO_ModulCount++; } uint uResult = CAXL.AxlOpen(lIrqNo); AXT_FUNC_RESULT enReult; if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum b = false; s = String.Format("AxlOpen Fail : IRQ[{0}], Error Code[{1}] - {2}", lIrqNo, uResult, enReult); return; } #region DIO Modul Check uResult = CAXD.AxdInfoIsDIOModule(ref uStatus); if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum b = false; s = String.Format("DIO Module Exist Check Fail : Error Code[{0}] - {1}", uResult, enReult); return; } if ((AXT_EXISTENCE)uStatus != AXT_EXISTENCE.STATUS_EXIST) { if (DI_ModulCount + DO_ModulCount > 0) { b = false; s = "CANNOT Find DIO Module!"; return; } } //uResult = CAXD.AxdInfoGetModuleCount(ref nDIOModule); //if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) //{ // enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum // b = false; s = String.Format("DIO Module Count Check Fail : Error Code[{0}] - {1}", uResult, enReult); return; //} //if (DI_ModulCount + DO_ModulCount != nDIOModule) //{ // b = false; s = String.Format("DIO Module Count Mismatch : Find[{0}] Need[{1}]", nDIOModule, (DI_ModulCount + DO_ModulCount)); return; //} int nBoardNo = 0; int nModulePos = 0; uint uModuleID = 0; for (int i = 0; i < nDIOModule; i++) { uResult = CAXD.AxdInfoGetModule(i, ref nBoardNo, ref nModulePos, ref uModuleID); if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum b = false; s = "DIO Module[" + i.ToString() + "] Check Fail : Error Code[" + uResult.ToString() + "] - " + enReult.ToString(); return; } if (nBoardNo == 0) { if (nModulePos == 0) { if (sub1 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub1 modul " + sub1.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else if (nModulePos == 1) { if (sub2 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub2 modul " + sub2.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else { b = false; s = "nBoardNo[0] uModuleID : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else if (nBoardNo == 1) { if (nModulePos == 0) { if (sub3 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub3 modul " + sub3.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else if (nModulePos == 1) { if (sub4 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub4 modul " + sub4.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else { b = false; s = "nBoardNo[1] uModuleID : " + ((AXT_MODULE)uModuleID).ToString(); return; } } //if (nBoardNo != 0) { b = false; s = "Fail : DIO nBoardNo " + nBoardNo.ToString(); return; } //if (nModulePos == 0) //{ // if (sub1 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub1 modul " + sub1.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} //if (nModulePos == 1) //{ // if (sub2 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub2 modul " + sub2.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} //if (nModulePos == 2) //{ // if (sub3 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub3 modul " + sub3.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} //if (nModulePos == 3) //{ // if (sub4 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub4 modul " + sub4.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} } #endregion #region AIO Modul Check uResult = CAXA.AxaInfoIsAIOModule(ref uStatus); if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum b = false; s = "DIO Module Exist Check Fail : Error Code[" + uResult.ToString() + "] - " + enReult.ToString(); return; } if ((AXT_EXISTENCE)uStatus != AXT_EXISTENCE.STATUS_EXIST) { if (AIO_ModulCount > 0) { b = false; s = "CANNOT Find AIO Module!"; return; } } uResult = CAXA.AxaInfoGetModuleCount(ref nAIOModule); if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum b = false; s = "AIO Module Count Check Fail : Error Code[" + uResult.ToString() + "] - " + enReult.ToString(); return; } if (AIO_ModulCount != nAIOModule) { b = false; s = "AIO Module Count Mismatch : Find[" + nAIOModule.ToString() + "] Need[" + (AIO_ModulCount).ToString() + "]"; return; } for (int i = 0; i < nAIOModule; i++) { uResult = CAXA.AxaInfoGetModule(i, ref nBoardNo, ref nModulePos, ref uModuleID); if (uResult != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { enReult = (AXT_FUNC_RESULT)uResult; // convert int to enum b = false; s = "Analog Module[" + i.ToString() + "] Check Fail : Error Code[" + uResult.ToString() + "] - " + enReult.ToString(); return; } if (nBoardNo == 0) { if (nModulePos == 0) { if (sub1 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub1 modul " + sub1.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else if (nModulePos == 1) { if (sub2 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub2 modul " + sub2.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else { b = false; s = "nBoardNo[0] uModuleID : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else if (nBoardNo == 1) { if (nModulePos == 0) { if (sub3 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub3 modul " + sub1.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else if (nModulePos == 1) { if (sub4 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub4 modul " + sub2.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } } else { b = false; s = "nBoardNo[1] uModuleID : " + ((AXT_MODULE)uModuleID).ToString(); return; } } //if (nBoardNo != 1) { b = false; s = "AIO nBoardNo " + nBoardNo.ToString() + " : Fail"; return; } //if (nModulePos == 0) //{ // if (sub1 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub1 modul " + sub1.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} //if (nModulePos == 1) //{ // if (sub2 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub2 modul " + sub2.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} //if (nModulePos == 2) //{ // if (sub3 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub3 modul " + sub3.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} //if (nModulePos == 3) //{ // if (sub4 != (AXT_MODULE)uModuleID) { b = false; s = "Fail : sub4 modul " + sub4.ToString() + " : " + ((AXT_MODULE)uModuleID).ToString(); return; } //} } CAXA.AxaoInfoGetChannelCount(ref AO_ChannelCount); if (AO_ChannelCount != nAIOModule * 4) { b = false; s = "Anlog Output Channel Count Check Fail : " + (nAIOModule * 4).ToString() + " : " + AO_ChannelCount.ToString(); return; } for (int i = 0; i < AO_ChannelCount; ++i) { // 출력 Channel에 0V를 출력한다. CAXA.AxaoWriteVoltage(i, 0); } CAXA.AxaiInfoGetChannelCount(ref AI_ChannelCount); if (AI_ChannelCount != nAIOModule * 8) { b = false; s = "Analog Input Channel Count Check Fail : " + (nAIOModule * 8).ToString() + " : " + AI_ChannelCount.ToString(); return; } #endregion b = true; s = "OK"; isActivate = true; } catch { b = false; s = "Exception Error"; isActivate = false; } }