loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt probe_parport loadrt debounce cfg=3 loadrt hostmot2 loadrt hm2_7i43 config="firmware=hm2/7i43/SVST4_4B.BIT num_encoders=2 num_pwmgens=1 num_stepgens=4" loadrt invert count=1 # no divide in hal, so use invert and scale loadrt scale count=1 # scale is used to divide the spindle command by the gear ratio loadrt mux2 count=1 # the mux is used to store the offset as a sample-and-hold loadrt ddt count=1 # used for change detection in the gear ratio to reset the axes loadrt abs count=1 loadrt comp count=1 # convert non-zero to toggle a bit on change show all addf motion-command-handler servo-thread addf motion-controller servo-thread addf hm2_7i43.0.read servo-thread addf hm2_7i43.0.write servo-thread addf hm2_7i43.0.pet_watchdog servo-thread addf debounce.0 servo-thread addf invert.0 servo-thread #mult and invert are used to divide by the gear ratio addf scale.0 servo-thread addf mux2.0 servo-thread addf ddt.0 servo-thread addf abs.0 servo-thread addf comp.0 servo-thread #Setup GPIO #Spindle direction setp hm2_7i43.0.gpio.008.is_output 1 setp hm2_7i43.0.gpio.008.is_opendrain 0 net spindle-cw <= motion.spindle-forward => hm2_7i43.0.gpio.008.out setp hm2_7i43.0.gpio.010.is_output 1 setp hm2_7i43.0.gpio.010.is_opendrain 0 net spindle-ccw <= motion.spindle-reverse => hm2_7i43.0.gpio.010.out #Spindle choice setp hm2_7i43.0.gpio.012.is_output 1 setp hm2_7i43.0.gpio.012.is_opendrain 0 net spindle-select => hm2_7i43.0.gpio.012.out sets spindle-select 0 #limit switches setp debounce.0.delay 5 setp hm2_7i43.0.gpio.016.is_output 0 setp hm2_7i43.0.gpio.017.is_output 0 setp hm2_7i43.0.gpio.018.is_output 0 #Amp-Enables setp hm2_7i43.0.gpio.026.is_output 1 setp hm2_7i43.0.gpio.026.is_opendrain 0 setp hm2_7i43.0.gpio.032.is_output 1 setp hm2_7i43.0.gpio.032.is_opendrain 0 setp hm2_7i43.0.gpio.038.is_output 1 setp hm2_7i43.0.gpio.038.is_opendrain 0 setp hm2_7i43.0.gpio.044.is_output 1 setp hm2_7i43.0.gpio.044.is_opendrain 0 # VFD Enable setp hm2_7i43.0.gpio.022.is_output 1 setp hm2_7i43.0.gpio.022.is_opendrain 0 # Main Breaker setp hm2_7i43.0.gpio.023.is_output 1 setp hm2_7i43.0.gpio.023.is_opendrain 0 setp hm2_7i43.0.gpio.023.invert_output 1 net estop-out <= iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in => hm2_7i43.0.gpio.023.out # Front-Panel LEDs setp hm2_7i43.0.gpio.027.is_output 1 setp hm2_7i43.0.gpio.027.is_opendrain 0 net LED0 => hm2_7i43.0.gpio.027.out setp hm2_7i43.0.gpio.028.is_output 1 setp hm2_7i43.0.gpio.028.is_opendrain 0 net LED1 => hm2_7i43.0.gpio.028.out setp hm2_7i43.0.gpio.029.is_output 1 setp hm2_7i43.0.gpio.029.is_opendrain 0 net LED2 => hm2_7i43.0.gpio.029.out setp hm2_7i43.0.gpio.033.is_output 1 setp hm2_7i43.0.gpio.033.is_opendrain 0 net LED3 => hm2_7i43.0.gpio.033.out setp hm2_7i43.0.gpio.034.is_output 1 setp hm2_7i43.0.gpio.034.is_opendrain 0 net LED4 => hm2_7i43.0.gpio.034.out setp hm2_7i43.0.gpio.035.is_output 1 setp hm2_7i43.0.gpio.035.is_opendrain 0 net LED5 => hm2_7i43.0.gpio.035.out setp hm2_7i43.0.gpio.039.is_output 1 setp hm2_7i43.0.gpio.039.is_opendrain 0 net LED6 => hm2_7i43.0.gpio.039.out setp hm2_7i43.0.gpio.040.is_output 1 setp hm2_7i43.0.gpio.040.is_opendrain 0 net LED7 => hm2_7i43.0.gpio.040.out setp hm2_7i43.0.gpio.041.is_output 1 setp hm2_7i43.0.gpio.041.is_opendrain 0 net LED8 => hm2_7i43.0.gpio.041.out net spindle-cmd <= motion.spindle-speed-out => hm2_7i43.0.pwmgen.00.value net spindle-enable <= motion.spindle-on => hm2_7i43.0.pwmgen.00.enable setp hm2_7i43.0.pwmgen.00.output-type 1 setp hm2_7i43.0.pwmgen.pwm_frequency 500 setp hm2_7i43.0.pwmgen.00.scale 800 # X-Axis setp hm2_7i43.0.stepgen.00.step_type 0 setp hm2_7i43.0.stepgen.00.position-scale [AXIS_0]SCALE setp hm2_7i43.0.stepgen.00.steplen [AXIS_0]STEPLEN setp hm2_7i43.0.stepgen.00.stepspace [AXIS_0]STEPSPACE setp hm2_7i43.0.stepgen.00.dirhold [AXIS_0]DIRHOLD setp hm2_7i43.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP setp hm2_7i43.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL net xpos-cmd axis.0.motor-pos-cmd => hm2_7i43.0.stepgen.00.position-cmd net xpos-fb hm2_7i43.0.stepgen.00.position-fb => axis.0.motor-pos-fb net xenable axis.0.amp-enable-out => hm2_7i43.0.stepgen.00.enable => hm2_7i43.0.gpio.026.out => hm2_7i43.0.gpio.022.out net xlimunfilt debounce.0.0.in <= hm2_7i43.0.gpio.016.in_not => axis.0.home-sw-in net both-x <= debounce.0.0.out net both-x => axis.0.neg-lim-sw-in net both-x => axis.0.pos-lim-sw-in # Y-Axis setp hm2_7i43.0.stepgen.01.step_type 0 setp hm2_7i43.0.stepgen.01.position-scale [AXIS_1]SCALE setp hm2_7i43.0.stepgen.01.steplen [AXIS_1]STEPLEN setp hm2_7i43.0.stepgen.01.stepspace [AXIS_1]STEPSPACE setp hm2_7i43.0.stepgen.01.dirhold [AXIS_1]DIRHOLD setp hm2_7i43.0.stepgen.01.dirsetup [AXIS_1]DIRSETUP setp hm2_7i43.0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL net ypos-cmd axis.1.motor-pos-cmd => hm2_7i43.0.stepgen.01.position-cmd net ypos-fb hm2_7i43.0.stepgen.01.position-fb => axis.1.motor-pos-fb net yenable axis.1.amp-enable-out => hm2_7i43.0.stepgen.01.enable => hm2_7i43.0.gpio.032.out net ylimunfilt debounce.0.1.in <= hm2_7i43.0.gpio.017.in_not => axis.1.home-sw-in net both-y <= debounce.0.1.out net both-y => axis.1.neg-lim-sw-in net both-y => axis.1.pos-lim-sw-in # Z-Axis setp hm2_7i43.0.stepgen.02.step_type 0 setp hm2_7i43.0.stepgen.02.position-scale [AXIS_2]SCALE setp hm2_7i43.0.stepgen.02.steplen [AXIS_2]STEPLEN setp hm2_7i43.0.stepgen.02.stepspace [AXIS_2]STEPSPACE setp hm2_7i43.0.stepgen.02.dirhold [AXIS_2]DIRHOLD setp hm2_7i43.0.stepgen.02.dirsetup [AXIS_2]DIRSETUP setp hm2_7i43.0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL net zpos-cmd axis.2.motor-pos-cmd => hm2_7i43.0.stepgen.02.position-cmd net zpos-fb hm2_7i43.0.stepgen.02.position-fb => axis.2.motor-pos-fb net zenable axis.2.amp-enable-out => hm2_7i43.0.stepgen.02.enable => hm2_7i43.0.gpio.038.out net zlimunfilt debounce.0.2.in <= hm2_7i43.0.gpio.019.in_not => axis.2.home-sw-in net both-z <= debounce.0.2.out net both-z => axis.2.neg-lim-sw-in net both-z => axis.2.pos-lim-sw-in # A-Axis setp hm2_7i43.0.stepgen.03.step_type 0 setp hm2_7i43.0.stepgen.03.position-scale [AXIS_3]SCALE setp hm2_7i43.0.stepgen.03.steplen [AXIS_3]STEPLEN setp hm2_7i43.0.stepgen.03.stepspace [AXIS_3]STEPSPACE setp hm2_7i43.0.stepgen.03.dirhold [AXIS_3]DIRHOLD setp hm2_7i43.0.stepgen.03.dirsetup [AXIS_3]DIRSETUP setp hm2_7i43.0.stepgen.03.maxaccel [AXIS_3]STEPGEN_MAXACCEL setp hm2_7i43.0.encoder.00.scale -200 # Electronic gearing of stepgen position to encoder position net invratio invert.0.out => scale.0.gain ddt.0.in # the ratio is linked in the postgui.hal to invert.0.in net spindlepos hm2_7i43.0.encoder.00.position => scale.0.in net gearpos scale.0.out => hm2_7i43.0.stepgen.03.position-cmd net aenable axis.3.amp-enable-out => hm2_7i43.0.stepgen.03.enable => hm2_7i43.0.gpio.044.out # Reset Logic. Zeroes the encoder and stores the current stepgen position as an offset. # This is to prevent the gear rotating to on tooth-count changes (often quite interminably) net scale-change ddt.0.out => abs.0.in net abs-scale-change abs.0.out => comp.0.in1 setp comp.0.in0 0.01 # this is looking for changes in 1/teeth as the raw value is not available until postgui.hal has run net reset-spindles comp.0.out => hm2_7i43.0.encoder.00.reset mux2.0.sel # this bit toggles high on a ratio change net sample-hold mux2.0.out => mux2.0.in0 scale.0.offset # the mux is wired to itself as a floating point sample-and-hold net gear-spindle-position hm2_7i43.0.stepgen.03.position-fb => mux2.0.in1 # wire the stepgen position to the sample and hold, and thence to the scale net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in net estop-out => hm2_7i43.0.gpio.023.out loadusr -W hal_manualtoolchange net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared