I haven't done a thorough study of this yet, I believe you only need to
satisfy these two signals:
"...
motion.spindle-index-enable I/O bit
        For correct operation of spindle synchronized moves, this signal
        must be hooked to the index-enable pin of the spindle encoder.
motion.spindle-revs IN float
        For correct operation of spindle synchronized moves, this signal
        must be hooked to the position pin of the spindle encoder.
..."
from:

http://www.linuxcnc.org/docs/html/config/emc2hal/emc2hal.html

How you go about satisfying these signals may depend on your hardware.
For my HNC lathe, I originally had a pulse generator with index, but my
Pico UPC only had quadrature encoder inputs, so I had to install a
quadrature encoder.

--- hnc_motion-3a.hal ---
"...
# report rev count to motion controller
newsig spindle-pos float
linksp spindle-pos ppmc.0.encoder.03.position
linksp spindle-pos motion.spindle-revs
...
--- hnc_io-3a.hal
# connect index pulses to motion controller
...
newsig spindle-index-enable bit
linksp spindle-index-enable <= ppmc.0.encoder.03.index-enable
linksp spindle-index-enable => motion.spindle-index-enable
..."

I had an option to use the hal component encoder:

http://www.linuxcnc.org/docs/html/man/man9/encoder.9.html

through my parallel port but this encoder isn't fast enough.

The following may be out of date. I think some signal names have
changed, but here is an example from:

http://cvs.linuxcnc.org/cvs/emc2/configs/nist-lathe/nist-lathe.hal?rev=1.6

"...
# counting the spindle encoder in software
loadrt encoder num_chan=1
...
# first we read parport inputs
addf parport.0.read             base-thread
# update encoder counter
addf encoder.update-counters    base-thread
...
# capture axis and spindle positions
addf stepgen.capture-position   servo-thread
addf encoder.capture-position   servo-thread
# process motion commands coming from user space
addf motion-command-handler     servo-thread
# run main motion controller
addf motion-controller          servo-thread
...
# end of basic machine

#######################################################
# Beginning of threading-related stuff
#######################################################

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

linkps parport.0.pin-11-in => spindle-phase-A
linkps parport.0.pin-12-in => spindle-phase-B
linkps parport.0.pin-13-in => spindle-phase-Z

newsig homeswitches bit
linkps parport.0.pin-10-in => homeswitches
linkps axis.0.home-sw-in <= homeswitches
linkps axis.2.home-sw-in <= homeswitches

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

# 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 => encoder.0.index-enable
   (might now be motion.spindle-index-enable)

# report our revolution count to the motion controller
newsig spindle-pos float
linkps encoder.0.position => spindle-pos
linksp spindle-pos => motion.spindle-revs
..."

If I didn't need the speed, I may have been able to use my original
pulse generator by combining the spindle Forward/Reverse signals and
the pulse generator signal to derive the inputs for the motion.spindle
signals.

It also has been mentioned in the past, that you if your commanded
spindle speed and actual spindle speed matched, you could derive the
position information from the spindle speed command. So you wouldn't
even need and encoder or pulse generator, just an index.

On Sat, 2007-10-27 at 22:57 +0200, Geert De Pecker wrote:
> Hi,
> 
> It is not quit clear to me what exactly is needed in order to do
> threading on the lathe with emc:
> 
> Do you need a single synchronization pulse from the spindle to act as a
> base for the sync
> 
> Or
> 
> Do you need a sync pulse AND an encoder (eg 50 ppr) together?

Yes. The spindle encoder index pulse starts the selected axes motion,
then the spindle encoder position pulses are the basis (electronic
gearing) for the axes motion. I found out that, for successive
synchronized motion commands, index is used only for the first command
and the position is passed to the successive commands. 

> Thanks for the clarification.

Hopefully, others here will correct anything that I got wrong.

> Is there aa doc somewhere that describes this?
> 
> Thanks,
> 
> Geert

-- 
Kirk Wallace (California, USA
http://www.wallacecompany.com/machine_shop/ 
Hardinge HNC lathe
Bridgeport mill conversion pending
Zubal lathe conversion pending)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to