Absolute encoders like to use lots of bits. This rather requires that
the counts be accumulated into a 64-bit datatype.
LinuxCNC rather expects to be able to set an index-enable on an
encoder and have stuff happen.
It is easy in principle to supply a pulses-per-rev parameter and make
the encoder output behave like there was an index and reset.
However, for an arbitrary ppr value it gets a bit tricky to spot the
pseudo-index.
if ( abs ( s64_new % ppr - s64_old % ppr) > ppr / 2)){
is the obvious way, but gives:
WARNING: "__moddi3" [/home/andypugh/git/linuxcnc-dev/src/hostmot2.ko] undefined!
No 64-bit remainder without a library function.
So, I tried to eliminate the mod:
if (abs ( s64_new - ppr * (s64_new / ppr) - s64_old - ppr * (s64_old /
ppr)) > ppr /2 ){
But that just swaps the warning to:
WARNING: "__divdi3" [/home/andypugh/git/linuxcnc-dev/src/hostmot2.ko] undefined!
In fact, no _signed_ 64 bit division available either.
In the lcd.c code I had a similar problem, and got round it by using do_div().
The problem with do_div is that not only does it return the modulus,
but it divides the first coefficient in place, and I _really_ don't
want to be doing that.
Is there anything more elegant available than:
temp1 = s64_new;
temp2 = s64_old;
if ( abs(do_div(temp1,ppr) - do_div(temp2,ppr)) > ppr / 2)){
?
--
atp
If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers