public void updateShow(TYPE_INPUT inputs) { if (tools.IS_INPUT_LEARN(inputs)) { cBoxInputModeLvl.Text = "进入学习模式"; } else if (tools.IS_INPUT_FIRING(inputs)) { cBoxInputModeLvl.Text = "触发采样"; } else if (tools.IS_INPUT_SETUP(inputs)) { cBoxInputModeLvl.Text = "进入设置模式"; } if (tools.IS_INPPUT_POS(inputs)) { cBoxInputPolLvl.Text = "上升沿触发"; } else { cBoxInputPolLvl.Text = "下降沿触发"; } }
public void UpdateShow(CFG_T cfg) { //modelNum cBoxModelNum.Text = cfg.modelNum.ToString(); //如果只有一个基准线型,则基准线型2相关设置灰化 if (cBoxModelNum.Text == "1") { gBoxModel2.Enabled = false; gBoxAdvanceModel2.Enabled = false; } else { gBoxModel2.Enabled = true; gBoxAdvanceModel2.Enabled = false; } ckBoxAutoAdjSpeed.Checked = (cfg.isSpeedAdj != 0); //速度补偿 cBoxLearnNum.Text = cfg.learnNum.ToString(); //学习数量 tBoxSensorSensitivity.Text = cfg.senThresh.ToString(); //传感器灵敏度% //检测模式 ANAL_TYPE type = cfg.wire[0].tol.analEN; ckBoxCorePos1.Checked = IS_ANAL_CORE_POS(type); ckBoxCoreWidth1.Checked = IS_ANAL_CORE_WIDTH(type); ckBoxSealPos1.Checked = IS_ANAL_SEAL_POS(type); ckBoxSealWidth1.Checked = IS_ANAL_SEAL_WIDTH(type); ckBoxStripPos1.Checked = IS_ANAL_STRIP_POS(type); ckBoxStripLen1.Checked = IS_ANAL_STRIP_LEN(type); ckBoxSplay1.Checked = IS_ANAL_SPLAY(type); ckBoxSeal1.Checked = IS_ANAL_SEAL(type); type = cfg.wire[1].tol.analEN; ckBoxCorePos2.Checked = IS_ANAL_CORE_POS(type); ckBoxCoreWidth2.Checked = IS_ANAL_CORE_WIDTH(type); ckBoxSealPos2.Checked = IS_ANAL_SEAL_POS(type); ckBoxSealWidth2.Checked = IS_ANAL_SEAL_WIDTH(type); ckBoxStripPos2.Checked = IS_ANAL_STRIP_POS(type); ckBoxStripLen2.Checked = IS_ANAL_STRIP_LEN(type); ckBoxSplay2.Checked = IS_ANAL_SPLAY(type); ckBoxSeal2.Checked = IS_ANAL_SEAL(type); //检测参数设置 tBoxCorePosN1.Text = cfg.wire[0].tol.corePosN.ToString() + "mm"; tBoxCorePosN2.Text = cfg.wire[1].tol.corePosN.ToString() + "mm"; tBoxCorePosP1.Text = cfg.wire[0].tol.corePosP.ToString() + "mm"; tBoxCorePosP2.Text = cfg.wire[1].tol.corePosP.ToString() + "mm"; tBoxSealPosN1.Text = cfg.wire[0].tol.sealPosN.ToString() + "mm"; tBoxSealPosN2.Text = cfg.wire[1].tol.sealPosN.ToString() + "mm"; tBoxSealPosP1.Text = cfg.wire[0].tol.sealPosP.ToString() + "mm"; tBoxSealPosP2.Text = cfg.wire[1].tol.sealPosP.ToString() + "mm"; tBoxStripPosN1.Text = cfg.wire[0].tol.stripPosN.ToString() + "mm"; tBoxStripPosN2.Text = cfg.wire[1].tol.stripPosN.ToString() + "mm"; tBoxStripPosP1.Text = cfg.wire[0].tol.stripPosP.ToString() + "mm"; tBoxStripPosP2.Text = cfg.wire[1].tol.stripPosP.ToString() + "mm"; tBoxStripLenN1.Text = cfg.wire[0].tol.stripLenN.ToString() + "mm"; tBoxStripLenN2.Text = cfg.wire[1].tol.stripLenN.ToString() + "mm"; tBoxStripLenP1.Text = cfg.wire[0].tol.stripLenP.ToString() + "mm"; tBoxStripLenP2.Text = cfg.wire[1].tol.stripLenP.ToString() + "mm"; tBoxCoreWidthN1.Text = cfg.wire[0].tol.coreWidthN.ToString() + "%"; tBoxCoreWidthN2.Text = cfg.wire[1].tol.coreWidthN.ToString() + "%"; tBoxCoreWidthP1.Text = cfg.wire[0].tol.coreWidthP.ToString() + "%"; tBoxCoreWidthP2.Text = cfg.wire[1].tol.coreWidthP.ToString() + "%"; tBoxSealWidthN1.Text = cfg.wire[0].tol.sealWidthN.ToString() + "%"; tBoxSealWidthN2.Text = cfg.wire[1].tol.sealWidthN.ToString() + "%"; tBoxSealWidthP1.Text = cfg.wire[0].tol.sealWidthP.ToString() + "%"; tBoxSealWidthP2.Text = cfg.wire[1].tol.sealWidthP.ToString() + "%"; tBoxVariationFilter1.Text = cfg.wire[0].tol.variationFilter.ToString() + "mm"; tBoxVariationFilter2.Text = cfg.wire[1].tol.variationFilter.ToString() + "mm"; tBoxSealLimit1.Text = cfg.wire[0].tol.sealLimit.ToString() + "%"; tBoxSealLimit2.Text = cfg.wire[1].tol.sealLimit.ToString() + "%"; tBoxStripLimit1.Text = cfg.wire[0].tol.stripLimit.ToString() + "%"; tBoxStripLimit2.Text = cfg.wire[1].tol.stripLimit.ToString() + "%"; tBoxSealRatio1.Text = cfg.wire[0].tol.sealRatio.ToString() + "%"; tBoxSealRatio2.Text = cfg.wire[1].tol.sealRatio.ToString() + "%"; //输入 怎样使用控件数组防止代码拷贝? TYPE_INPUT input = cfg.inputMode[0]; if (IS_INPUT_LEARN(input)) { cBoxInputModeLvl1.Text = "进入学习模式"; } else if (IS_INPUT_FIRING(input)) { cBoxInputModeLvl1.Text = "触发采样"; } else if (IS_INPUT_SETUP(input)) { cBoxInputModeLvl1.Text = "进入设置模式"; } if (IS_INPPUT_POS(input)) { cBoxInputPolLvl1.Text = "上升沿触发"; } else { cBoxInputPolLvl1.Text = "下降沿触发"; } input = cfg.inputMode[1]; if (IS_INPUT_LEARN(input)) { cBoxInputModeLvl2.Text = "进入学习模式"; } else if (IS_INPUT_FIRING(input)) { cBoxInputModeLvl2.Text = "触发采样"; } else if (IS_INPUT_SETUP(input)) { cBoxInputModeLvl2.Text = "进入设置模式"; } if (IS_INPPUT_POS(input)) { cBoxInputPolLvl2.Text = "上升沿触发"; } else { cBoxInputPolLvl2.Text = "下降沿触发"; } input = cfg.inputMode[2]; if (IS_INPUT_LEARN(input)) { cBoxInputModeLvl3.Text = "进入学习模式"; } else if (IS_INPUT_FIRING(input)) { cBoxInputModeLvl3.Text = "触发采样"; } else if (IS_INPUT_SETUP(input)) { cBoxInputModeLvl3.Text = "进入设置模式"; } if (IS_INPPUT_POS(input)) { cBoxInputPolLvl3.Text = "上升沿触发"; } else { cBoxInputPolLvl3.Text = "下降沿触发"; } input = cfg.inputMode[3]; if (IS_INPUT_LEARN(input)) { cBoxInputModeLvl4.Text = "进入学习模式"; } else if (IS_INPUT_FIRING(input)) { cBoxInputModeLvl4.Text = "触发采样"; } else if (IS_INPUT_SETUP(input)) { cBoxInputModeLvl4.Text = "进入设置模式"; } if (IS_INPPUT_POS(input)) { cBoxInputPolLvl4.Text = "上升沿触发"; } else { cBoxInputPolLvl4.Text = "下降沿触发"; } //输出 TYPE_OUTPUT output = cfg.outputMode[0]; if (IS_OUTPUT_NO(output)) { rBtnNO1.Checked = true; } else { rBtnNC1.Checked = true; } if (IS_OUTPUT_ANY(output)) { cBoxOutMode1.Text = "合格/不良品都输出脉冲"; } else if (IS_OUTPUT_PASS(output)) { cBoxOutMode1.Text = "合格品输出脉冲"; } else if (IS_OUTPUT_FAIL(output)) { cBoxOutMode1.Text = "不良品输出脉冲"; } if (IS_OUTPUT_ING_FIRST(output)) { rBtnIgnoreFirst1.Checked = true; } else if (IS_OUTPUT_ING_LEARN(output)) { rBtnIgnoreLearn1.Checked = true; } else { rBtnNormal1.Checked = true; } tBoxOutDelay1.Text = cfg.outputDelay[0].ToString(); tBoxDuration1.Text = cfg.outputWidth[0].ToString(); output = cfg.outputMode[1]; if (IS_OUTPUT_NO(output)) { rBtnNO2.Checked = true; } else { rBtnNC2.Checked = true; } if (IS_OUTPUT_PASS(output)) { cBoxOutMode2.Text = "合格品输出脉冲"; } else if (IS_OUTPUT_FAIL(output)) { cBoxOutMode2.Text = "不良品输出脉冲"; } else if (IS_OUTPUT_ANY(output)) { cBoxOutMode2.Text = "合格/不良品都输出脉冲"; } if (IS_OUTPUT_ING_FIRST(output)) { rBtnIgnoreFirst2.Checked = true; } else if (IS_OUTPUT_ING_LEARN(output)) { rBtnIgnoreLearn2.Checked = true; } else { rBtnNormal2.Checked = true; } tBoxOutDelay2.Text = cfg.outputDelay[1].ToString(); tBoxDuration2.Text = cfg.outputWidth[1].ToString(); //输出有效期间忽略输入(忽略返程阶段) checkBoxOutIgnoreWhileOutActive.Checked = (cfg.isIgnInWhenOut != 0); }
public bool IS_INPPUT_NEG(TYPE_INPUT input) { return(TYPE_INPUT.INPUT_NEG == (TYPE_INPUT)((UInt32)input & (UInt32)TYPE_INPUT.INPUT_NEG)); }
public bool IS_INPPUT_POS(TYPE_INPUT input) { return(TYPE_INPUT.INPUT_POS == (TYPE_INPUT)((UInt32)input & (UInt32)TYPE_INPUT.INPUT_POS)); }
public bool IS_INPUT_SETUP(TYPE_INPUT input) { return(TYPE_INPUT.INPUT_SETUP == (TYPE_INPUT)((UInt32)input & 0x0006)); }
public bool IS_INPUT_FIRING(TYPE_INPUT input) { return(TYPE_INPUT.INPUT_FIRING == (TYPE_INPUT)((UInt32)input & 0x0006)); }
public bool IS_INPUT_LEARN(TYPE_INPUT input) { return(TYPE_INPUT.INPUT_LEARN == (TYPE_INPUT)((UInt32)input & 0x0006)); }
public bool IS_INPUT_LEVEL(TYPE_INPUT input) { return(TYPE_INPUT.INPUT_TRIG == (TYPE_INPUT)((UInt32)input & (UInt32)TYPE_INPUT.INPUT_TRIG)); }
//获取输入引脚属性 public bool IS_INPUT_EDGE(TYPE_INPUT input) { return(0 == ((UInt32)input & (UInt32)TYPE_INPUT.INPUT_TRIG)); }