rendered paste body# standard pinout config file for 3-axis steppers
# with encoders using 2 parport for I/O
#
# first load the parport driver
loadrt hal_parport cfg="0x0378 out 0xcc00 in"
loadrt encoder num_chan=1
#
# next connect the parport functions to threads
# read inputs first
#addf parport.0.read base-thread 1
addf parport.1.read base-thread 1
addf encoder.update-counters base-thread
# write outputs last
addf parport.0.write base-thread -1
#addf parport.1.write base-thread -1
addf encoder.capture-position servo-thread
#
# hook stuff together
setp encoder.0.position-scale 20480
linkpp encoder.0.phase-A <= parport.1.pin-09-in
linkpp encoder.0.phase-B <= parport.1.pin-08-in
linksp Zpos-fb <= encoder.0.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.1.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.1.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.1.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.1.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