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); } } }
/**Get Gate DAQ*/ private static int getGate(uint ascanNum, uint ascanPort, GateType gateType, ref PGate param) { int error_code; error_code = GetGateDAQ.Delay(ascanNum, ascanPort, gateType, ref param.Delay); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.Width(ascanNum, ascanPort, gateType, ref param.Width); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.Threshold(ascanNum, ascanPort, gateType, ref param.Threshold); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.IFActive(ascanNum, ascanPort, gateType, ref param.IF); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.TofMode(ascanNum, ascanPort, gateType, ref param.TofMode); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DnsActive(ascanNum, ascanPort, gateType, ref param.DnsActive); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DnsBw(ascanNum, ascanPort, gateType, ref param.DnsBw); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DnsStart(ascanNum, ascanPort, gateType, ref param.DnsStart); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DnsStep(ascanNum, ascanPort, gateType, ref param.DnsStep); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.AlarmLogic(ascanNum, ascanPort, gateType, ref param.AlarmLogic); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.ScActive(ascanNum, ascanPort, gateType, ref param.ScActive); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.ScCounter(ascanNum, ascanPort, gateType, ref param.ScCounter); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DtsActive(ascanNum, ascanPort, gateType, ref param.DtsActive); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DtsBand(ascanNum, ascanPort, gateType, ref param.DtsBand); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DtsStart(ascanNum, ascanPort, gateType, ref param.DtsStart); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.DtsStep(ascanNum, ascanPort, gateType, ref param.DtsStep); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.TolMonitorActive(ascanNum, ascanPort, gateType, ref param.TolMonitorActive); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.TolMonitorMax(ascanNum, ascanPort, gateType, ref param.TolMonitorMax); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.TolMonitorMin(ascanNum, ascanPort, gateType, ref param.TolMonitorMin); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.TolMonitorSc(ascanNum, ascanPort, gateType, ref param.TolMonitorSc); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.AlarmActive(ascanNum, ascanPort, gateType, ref param.AlarmActive); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.AlarmMode(ascanNum, ascanPort, gateType, ref param.AlarmMode); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.AlarmSignalLength(ascanNum, ascanPort, gateType, ref param.AlarmSignalLength); if (error_code != 0) { return(error_code); } //error_code = SetGateDAQ.AlarmTimeLength(ascanNum, gateType, param.); //if (error_code != 0) // return error_code; error_code = GetGateDAQ.AlarmActiveLevel(ascanNum, ascanPort, gateType, ref param.AlarmActiveLevel); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.MeasActive(ascanNum, ascanPort, gateType, ref param.MeasActive); if (error_code != 0) { return(error_code); } error_code = GetGateDAQ.MeasMode(ascanNum, ascanPort, gateType, ref param.MeasMode); if (error_code != 0) { return(error_code); } return(error_code); }