//tolerance monitor(TM) active public static int TolMonitorActive(uint ascanNum, GateType type, ref TMActive active) { int error_code; int gateNum = (int)type; uint attr = DaqAttrType.gate[gateNum].TolMonitorActive; uint val = 0; if (ascanNum < ascanNumMin || ascanNum > ascanNumMax) { error_code = -1; return(error_code); } if (type < gateTypeMin || type > gateTypeMax) { error_code = -1; return(error_code); } error_code = DAQ.daqGet(ascanNum, attr, ref val); if (error_code != (int)PDAQ_ERR.GOOD) { MessageShow.show("Error:Get Tolerance Monitor Active failed!", "错误:获取Tolerance Monitor Active失败!"); } active = (TMActive)val; return(error_code); }
private void initTolerance() { int error_code; TMActive gateActive = TMActive.OFF; TMActive dGateActive = TMActive.OFF; for (int tolMonitorIndex = 0; tolMonitorIndex < 4; tolMonitorIndex++) { error_code = GetGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, (GateType)tolMonitorIndex, ref gateActive); if (error_code != 0) { return; } error_code = GetDGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, (DGateType)tolMonitorIndex, ref dGateActive); if (error_code != 0) { return; } if (gateActive == TMActive.ON && dGateActive == TMActive.ON) { MessageShow.show("Warn:Gate and double gate tolerance monitor are all active,need to select one to active!", "警告:门容限误差和双门容限误差都打开,只能选择一种容限误差模式!"); } else if (gateActive == TMActive.ON) { ((CheckBox)(Controls.Find("check" + tolMonitorIndex + 1 + "ON", true)[0])).Checked = true; ((RadioButton)(Controls.Find("gate" + tolMonitorIndex + 1, true)[0])).Checked = true; } else if (dGateActive == TMActive.ON) { ((CheckBox)(Controls.Find("check" + tolMonitorIndex + 1 + "ON", true)[0])).Checked = true; ((RadioButton)(Controls.Find("dGate" + tolMonitorIndex + 1, true)[0])).Enabled = true; } else { setControlsEnabled(tolMonitorIndex + 1, false); } } }
public static int TolMonitorActive(uint ascanNum, uint ascanPort, DGateType type, TMActive active) { int error_code; int gateNum = (int)type; uint attr = DaqAttrType.dGate[gateNum].TolMonitorActive; uint val = (uint)active; if (ascanNum < ascanNumMin || ascanNum > ascanNumMax) { error_code = -1; return(error_code); } if (type < gateTypeMin || type > gateTypeMax) { error_code = -1; return(error_code); } error_code = DAQ.daqSet(ascanNum, ascanPort, attr, val); if (error_code != (int)PDAQ_ERR.GOOD) { MessageShow.show("Error:Set tolerance monitor active of double gate failed!", "错误:设置门的容限误差使能失败!"); } return(error_code); }