On Fri, 20 Mar 2020, John Dammeyer wrote:

Date: Fri, 20 Mar 2020 09:12:06 -0700
From: John Dammeyer <[email protected]>
Reply-To: "Enhanced Machine Controller (EMC)"
    <[email protected]>
To: "'Enhanced Machine Controller (EMC)'" <[email protected]>
Subject: Re: [Emc-users] A hal question?


But what happens when someone has a 2500 line encoder on the spindle creating
10,000 edges per rev.  or 200,000 edges per second at 1200 RPM.  Now that 8
threads deep hole is 1.6million.  Again, not an issue with a 32 bit signed
counter but a problem with a 16 bit.

Not an issue, the 16 bit hardware count is extended to 64 bits in the driver
(every servo thread) this does limit you to a 16 MHz maximum count rate at a 1
KHz servo thread but thats way above the capabilities of most encoders...


So let's see if I have the math right. At 16MHz we have an edge every 0.063 MicroSeconds. At most then we'd see 16,000 in a hardware 16 bit register ever 1 millisecond (the 1 khZ servo rate). This value is added to a 64 bit integer. Is the hardware counter cleared again? If not 1 mS later it would be 32,000 which is still positive. But on the next 1 mS check it's now 48,000 which is -17536 as a signed number and adding that

The overflow/wrap detection only becomes ambiguous for count deltas > 16384 per sample, you can take a look at how its done in the linuxCNC driver source if you are interested. The count is never cleared (this would invalidate velocity estimation amoungst other things)

There are probably hardware quadrature encoder counters that can be set to latch the value on command and clear the counter? I haven't checked the encoder on the BeagleBone for example to see if it has that feature. Certainly your FPGA stuff can be set up to do that.

You don't want to clear the counter if it can be avoided, for example the index logic does not clear the counter, but rather latches the count at index. The driver presents a number (position) that is cleared on index, but the hardware counter is not cleared.

As the spindle reverses that counter value drops and eventually becomes 
negative when B now leads A.

Have I got that right?

And if so, is there a minimum number of encoder pulses one can have per 
revolution before the tracking becomes flaky?


Yes, for tapping you need relatively high resolution for good Z axis tracking

John



Finally, at that speed, and an edge every 5 micro seconds, how does the
software ever figure out that the spindle is varying in speed?  Or is one of
the real time threads running maybe only 1 kHz actually look at the spindle
counter and compare it to what they expect every 1mS and then adjust the speed
of the Z axis?

Yes, the Z axis is "geared" to the spindle position

Thanks
John




Peter Wallace
Mesa Electronics


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



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


Peter Wallace
Mesa Electronics

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.



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

Reply via email to