All pastes #138629 Raw Edit

Lerneaen Hydra

public text v1 · immutable
#138629 ·published 2006-08-19 10:29 UTC
rendered paste body
######################################
# threading ##########################
######################################

#set pullup pin high
newsig pullup_pin bit
sets pullup_pin 1
linksp pullup_pin parport.0.pin-01-out

# counting the spindle encoder in software
loadrt counter num_chan=1
loadrt blocks not=1

# spindle encoder
# connect encoder signals to encoder counter
newsig spindle-phase-A bit
newsig spindle-phase-Z bit
linksp spindle-phase-A => counter.0.phase-A
linksp spindle-phase-Z => counter.0.phase-Z

linkps parport.0.pin-10-in => spindle-phase-A
linkps parport.0.pin-11-in => spindle-phase-Z

# (that way thread pitches can be straightforward,
#  a 20 tpi thread would multiply the encoder output
#  by 1/20, etc)
setp counter.0.position-scale 100

# encoder reset control
# this signal is driven by the motion
# controller, TRUE for synced motion, FALSE the rest of
# the time.
#
# hook up motion controller's sync output
newsig spindle-sync bit
linkps motion.spindle-sync => spindle-sync
# needs to be inverted to connect to index enable
newsig spindle-index-en bit
linksp spindle-sync	=> not.0.in
linkps not.0.out	=> spindle-index-en
linksp spindle-index-en	=> counter.0.index-enable
# counting the spindle encoder in software
# report our revolution count to the motion controller
newsig spindle-pos float
linkps counter.0.position => spindle-pos
linksp spindle-pos => motion.spindle-revs