private void setTolMonitorMin(GateType gateType, DGateType dGateType, double tolMonitorMin) { if ((TolMonitorMode)tolMonitorMode1 == TolMonitorMode.Gate) { SetGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, gateType, tolMonitorMin); } else { SetDGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, dGateType, tolMonitorMin); } }
private void setTolMonitorSc(GateType gateType, DGateType dGateType, uint suppressCnt) { if ((TolMonitorMode)tolMonitorMode1 == TolMonitorMode.Gate) { SetGateDAQ.TolMonitorSc(SelectAscan.sessionIndex, SelectAscan.port, gateType, suppressCnt); } else { SetDGateDAQ.TolMonitorSc(SelectAscan.sessionIndex, SelectAscan.port, dGateType, suppressCnt); } }
private void setCheckBox(int tolMonitorIndex, GateType gateType, DGateType dGateType) { bool isCheckBoxChecked; isCheckBoxChecked = ((CheckBox)(Controls.Find("checkBox" + tolMonitorIndex + "ON", true)[0])).Checked; if (isCheckBoxChecked == true) { setControlsEnabled(tolMonitorIndex, true); ((RadioButton)(Controls.Find("dGate" + tolMonitorIndex, true)[0])).Checked = true;//Active double gate tolerance monitor defaultly } else { setControlsEnabled(tolMonitorIndex, false); SetGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, gateType, TMActive.OFF); SetDGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, dGateType, TMActive.OFF); } }
private void getGateTolMonitor(GateType gateType, DGateType dGatetType, int tolMonitorIndex) { int error_code; double min = 0; double max = 0; uint suppressCnt = 0; //Close double gate tolerance active error_code = SetDGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, dGatetType, TMActive.OFF); if (error_code != 0) { return; } //Open gate tolerance active error_code = SetGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, gateType, TMActive.ON); if (error_code != 0) { return; } error_code = GetGateDAQ.TolMonitorMax(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref max); if (error_code != 0) { return; } ((NumericUpDown)(Controls.Find("numUpDownMax" + tolMonitorIndex, true)[0])).Text = max.ToString(); error_code = GetGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref min); if (error_code != 0) { return; } ((NumericUpDown)(Controls.Find("numUpDownMin" + tolMonitorIndex, true)[0])).Text = min.ToString(); error_code = GetGateDAQ.TolMonitorSc(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref suppressCnt); if (error_code != 0) { return; } ((NumericUpDown)(Controls.Find("numUpDownSc" + tolMonitorIndex, true)[0])).Text = suppressCnt.ToString(); }
/**Caculate tolMonitorMax and tolMonitorMin accordint to dGateType. * @param gateType1 and gateType2 accord to dGateType. * */ private void tolMonitorAccordToDGate(GateType gateType1, GateType gateType2, DGateType dGateType, int tolMonitorIndex) { int error_code; GateType gateType; double tolMonitorMax; double tolMonitorMin; int gate1 = 0; int gate2 = 1; double[] delay = new double[2] { 0, 0 }; //index=0,delay of gateType1;index=1,delay of gateType2 double[] width = new double[2] { 0, 0 }; double[] gateEnd = new double[2] { 0, 0 }; for (int i = 0; i < 2; i++) { if (i == 0) { gateType = gateType1; } else { gateType = gateType2; } error_code = GetGateDAQ.Delay(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref delay[i]); if (error_code != 0) { return; } error_code = GetGateDAQ.Width(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref width[i]); if (error_code != 0) { return; } gateEnd[i] = delay[i] + width[i]; } //caculate tolMonitorMax and tolMonitorMin if (delay[gate1] > delay[gate2]) { if (delay[gate1] > gateEnd[gate2]) { tolMonitorMax = gateEnd[gate1] - delay[gate2]; tolMonitorMin = delay[gate1] - gateEnd[gate2]; } else if (delay[gate1] <= gateEnd[gate2] && gateEnd[gate2] <= gateEnd[gate1]) { tolMonitorMax = gateEnd[gate1] - delay[gate2]; tolMonitorMin = 0; } else { tolMonitorMax = gateEnd[gate2] - delay[gate2]; tolMonitorMin = 0; } } else { if (delay[gate2] > gateEnd[gate1]) { tolMonitorMax = gateEnd[gate2] - delay[gate1]; tolMonitorMin = delay[gate2] - gateEnd[gate1]; } else if (delay[gate2] <= gateEnd[gate1] && gateEnd[gate1] <= gateEnd[gate2]) { tolMonitorMax = gateEnd[gate2] - delay[gate1]; tolMonitorMin = 0; } else { tolMonitorMax = gateEnd[gate1] - delay[gate1]; tolMonitorMin = 0; } } ((NumericUpDown)(Controls.Find("numUpDownMax" + tolMonitorIndex, true)[0])).Text = tolMonitorMax.ToString(); ((NumericUpDown)(Controls.Find("numUpDownMin" + tolMonitorIndex, true)[0])).Text = tolMonitorMin.ToString(); SetDGateDAQ.TolMonitorMax(SelectAscan.sessionIndex, SelectAscan.port, dGateType, tolMonitorMax); SetDGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, dGateType, tolMonitorMin); }