# add a limiter block
loadrt blocks limit1=1
#make it update it's output once / servo thread
addf limit1.0 servo-thread
# spindle speed control
newsig spindle-speed-cmd float
# limited spindle speed control
newsig spindle-speed-limited float
#get the spindle speed
linkps iocontrol.0.spindle-speed-out => spindle-speed-cmd
#and run it through a limiter
linksp spindle-speed-cmd => limit1.0.in
linkps limit1.0.out => spindle-speed-limited
# set min and max limits
setp limit1.0.min 0
setp limit1.0.max 1000 #adjust this to max RPM (or 10V*SPINDLE_VOLTS_PER_RPM)
#connect limited spindle speed to DAC
linksp spindle-speed-limited => motenc.0.dac-03-value
# scale & offset
setp motenc.0.dac-03-gain [EMCIO]SPINDLE_VOLTS_PER_RPM
# Set output offset from ini file.
setp motenc.0.dac-03-offset [EMCIO]SPINDLE_DAC_OFFSET