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

📄 steptest.comp

📁 CNC 的开放码,EMC2 V2.2.8版
💻 COMP
字号:
component steptest """\Used by Stepconf to allow testing of acceleration and velocity values for an axis.""";pin in bit jog-minus "Drive TRUE to jog the axis in its minus direction";pin in bit jog-plus "Drive TRUE to jog the axis in its positive direction";pin in bit run "Drive TRUE to run the axis near its current position_fb with a trapezoidal velocity profile";pin in float maxvel "Maximum velocity";pin in float maxaccel "Permitted Acceleration";pin in float amplitude "Approximate amplitude of positions to command during 'run'";pin in s32 dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative";pin out float position-cmd;pin in float position-fb;pin out bit running;pin out float run-target;pin out float run-start;pin out float run-low;pin out float run-high;param rw float epsilon = .001;function _;license "GPL";;;extern double fabs(double);if(run) {    if(!running) {        running = 1;        run_start = position_fb;        if(dir == 2) run_high = run_start;        else run_high = run_start + amplitude;        if(dir == 1) run_low = run_start;        else run_low = run_start - amplitude;        position_cmd = run_low;    }    if(fabs(position_fb - position_cmd) < epsilon) {        if(position_cmd == run_low) {            position_cmd = run_high;        } else {            position_cmd = run_low;        }    }} else if(running) {    position_cmd = run_start;    if(fabs(position_fb - run_start) < epsilon) {        running = 0;    }} else {    if(jog_minus) {        position_cmd = position_fb - maxvel * fperiod;    } else if(jog_plus) {        position_cmd = position_fb + maxvel * fperiod;    } else {        position_cmd = position_fb;    }}

⌨️ 快捷键说明

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