# standard pinout config file for 3-axis steppers
# with encoders using a parport for I/O
#
# first load the parport driver
loadrt hal_parport cfg="0x0378"
loadrt encoder num_chan=2
#
# next connect the parport functions to threads
# read inputs first
addf parport.0.read base-thread 1
addf encoder.update-counters base-thread
# write outputs last
addf parport.0.write base-thread -1
addf encoder.capture-position servo-thread
#
# hook stuff together
newsig Zpos-fb float
setp encoder.2.position-scale [AXIS_2]INPUT_SCALE
linkpp encoder.2.phase-A <= parport.0.pin-12-in
linkpp encoder.2.phase-B <= parport.0.pin-15-in
linksp Zpos-fb <= encoder.2.position
# finally connect physical pins to the signals
linksp Xstep => parport.0.pin-03-out
linksp Xdir => parport.0.pin-02-out
linksp Ystep => parport.0.pin-05-out
linksp Ydir => parport.0.pin-04-out
linksp Zstep => parport.0.pin-07-out
linksp Zdir => parport.0.pin-06-out
# create a signal for the estop loopback
## linkpp parport.0.pin-10-in iocontrol.0.emc-enable-in
# create signal for external estop
newsig ext-estop bit
linksp ext-estop parport.0.pin-10-in
linksp ext-estop iocontrol.0.emc-enable-in
# create signals for tool loading loopback
linkpp iocontrol.0.tool-prepare iocontrol.0.tool-prepared
linkpp iocontrol.0.tool-change iocontrol.0.tool-changed
# create a signal for "spindle on"
newsig spindle-on bit
# connect the controller to it
linkps motion.spindle-on => spindle-on
# connect it to a physical pin
linksp spindle-on => parport.0.pin-09-out
# spindle signals "spindle forw,rev"
# spindle status has not been resolved
# a simple loop through is set here
linkpp motion.spindle-forward parport.0.pin-16-out
# linkpp motion.spindle-reverse parport.0.pin-17-out
# Home/Limit Shared Switch on Same Pin
newsig Xswitches bit
linkps parport.0.pin-11-in-not => Xswitches
linksp Xswitches => axis.0.home-sw-in
linksp Xswitches => axis.0.neg-lim-sw-in
linksp Xswitches => axis.0.pos-lim-sw-in
#newsig Yswitches bit
#linkps parport.0.pin-12-in-not => Yswitches
#linksp Yswitches => axis.1.home-sw-in
#linksp Yswitches => axis.1.neg-lim-sw-in
#linksp Yswitches => axis.1.pos-lim-sw-in
newsig Zswitches bit
linkps parport.0.pin-13-in-not => Zswitches
linksp Zswitches => axis.2.home-sw-in
linksp Zswitches => axis.2.neg-lim-sw-in
linksp Zswitches => axis.2.pos-lim-sw-in
# coolant signals
# note that these do NOT represent proper IO signals from iocontrol
# should separate command and status for production versions
# and run these through CL to test conditions
linkpp iocontrol.0.coolant-flood parport.0.pin-08-out
# linkpp iocontrol.0.coolant-mist parport.0.pin-09-out
loadrt pwmgen output_type=1
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
setp pwmgen.0.scale 2000 # Change to your spindle & # 8217;s top speed in RPM