For an Automation Direct GS2 use the gs2 component and connect via modbus so you have full spindle control. You will need the braking resistor.
The hal on my BP with a GS2
Code:
# Spindle Drive
loadusr -Wn spindle-vfd gs2_vfd -s 2 -p none -A 0.5 -D 0.5 -R -n spindle-vfd -v
# connect the spindle direction pin to the GS2
net gs2-fwd spindle-vfd.spindle-fwd <= motion.spindle-forward
# connect the spindle on pin to the GS2
net gs2-run spindle-vfd.spindle-on <= motion.spindle-on
# connect the GS2 at speed to the motion at speed
net gs2-at-speed motion.spindle-at-speed <= spindle-vfd.at-speed
# connect the spindle RPM to the GS2
net gs2-RPM spindle-vfd.speed-command <= motion.spindle-speed-out
#vfd panel fan
net gs2-run => hm2_5i25.0.7i77.0.0.output-03
# Spindle Encoder
setp hm2_5i25.0.encoder.03.scale 10000
net spindle-position hm2_5i25.0.encoder.03.position => motion.spindle-revs
net spindle-velocity hm2_5i25.0.encoder.03.velocity => motion.spindle-speed-in
net spindle-index-enable hm2_5i25.0.encoder.03.index-enable <=> motion.spindle-index-enable
JT