You need to arrange to see all the bits of enc->accum and enc->offset.

The erroneous-seeming value for "position" is what you would get if all
the calculations you showed were taking place as expected, but the
difference (enc->accum - enc->offset) has some high bits unexpectely
set:

>>> x = 250 * (1<<32) + 2882
>>> print x
1073741826882
>>> print "%.7g" % x
1.073742e+12

One (untested) way to see all the bits would be (adjust for the type
names needed in rt code, is it u64 or __u64?):
    uint64_t count64 = (enc->accum - enc->offset);
    enc->hal.pin.count_lo_param = count64;       // low 32 bits
    enc->hal.pin.count_hi_param = count64 >> 32; // high 32 bits

If it turns out there are high bits that wouldn't appear in the s32
count, then you can determine whether they're in accum or offset
and figure out why they have (erroneously?) appeared.  (I would make a
modest bet they're in accum, because the high part of the value is
"positive-ish")

Good luck with your further troubleshooting.

Jeff

------------------------------------------------------------------------------
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

Reply via email to