On 23 April 2010 17:12, Schooner <[email protected]> wrote:

> loadrt encoder num_chan=1
> addf encoder.update-counters base-thread
> addf encoder.capture-position servo-thread
> setp encoder.0.position-scale 1
> net spindle-position encoder.0.position-interpolated => motion.spindle-revs
> net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
> net spindle-index-enable encoder.0.index-enable <=>
> motion.spindle-index-enable
> net spindle-pulse-and-index parport.0.pin-11-in => encoder.0.phase-A
> encoder.0.phase-Z ;set to correct pin. "
>
> /I am afraid I do not understand how encoder.0.phase-Z could be
> connected to anything, there is only one index pulse.

You can use the same p-port pin to drive more then one "logical pin"
in HAL. In this case you need to link the encoder A-phase to your
pin-11 so that EMC can calculate a spindle speed, and also the Z-phase
(which is the index pulse) to the same pin.

> I included the above into my .hal minus the last line.

You need the last line. Note that it is actually part of the line
above but has line-wrapped. There is another troublesome wrap in the
index-enable line.

> If I rotate the spindle manually, I get a positive indication every rev,
> so maybe the hal monitor
> display just cannot update quickly enough.

HAL monitor doesn't, know. For transient signals you should use
Halscope, it works a lot better. It is one of the most useful tools in
EMC in fact. It is in the same menu as the Hal Config and Hal meter.

> Have I missed something or is the answer that you cannot thread with
> just an index pulse and you must have a timing pulse too, connected to
> encoder.0.phase.Z perhaps??

Yes, you need both, but they can be from the same pickup and the same
parallel port line. Incidentally, I think you have speed and no index
rather than the other way round.

I think you might also need to add a line:
setp encoder.0.counter-mode 1
to the HAL to tell it to not look for the B-phase. Details here:
http://www.linuxcnc.org/docview/html//man/man9/encoder.9.html

> Would my 4 magnet set-up through a second pickup provide that, if a
> timing pulse is required , or is that too coarse?

More pulses is better, but a few inaccurately-times pulses is probably
worse than 1PPR for introducing errors to the spindle velocity
calculation.

-- 
atp

------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to