⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comp.comp

📁 CNC 的开放码,EMC2 V2.2.8版
💻 COMP
字号:
component comp "Two input comparator with hysteresis";pin in float in0 "Inverting input to the comparator";pin in float in1 "Non-inverting input to the comparator";pin out bit out "Normal output. True when \\fBin1\\fR > \\fBin0\\fR (see parameter \\fBhyst\\fR for details)";pin out bit equal "Match output.  True when difference between \\fBin1\\fR and \\fBin0\\fR is less than \\fBhyst\\fR/2";param rw float hyst=0.0 """Hysteresis of the comparator (default 0.0)With zero hysteresis, the output is true when \\fBin1\\fR > \\fBin0\\fR.  With nonzerohysteresis, the output switches on and off at two different values,separated by distance \\fBhyst\\fR around the point where \\fBin1\\fR = \\fBin0\\fR.Keep in mind that floating point calculations are never absoluteand it is wise to always set \\fBhyst\\fR if you intend to use equal """;function _ fp "Update the comparator";license "GPL";;;FUNCTION(_) {    float tmp = in1 - in0;    float halfhyst = 0.5 * hyst;    if(tmp < -halfhyst) {	out = 0;	equal = 0;    } else if(tmp > halfhyst){	out = 1;	equal = 0;    } else {	equal = 1;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -