On Wednesday 06 June 2018 13:50:31 Peter C. Wallace wrote: > On Wed, 6 Jun 2018, Ralph Stirling wrote: > > Date: Wed, 6 Jun 2018 16:41:24 +0000 > > From: Ralph Stirling <ralph.stirl...@wallawalla.edu> > > Reply-To: "Enhanced Machine Controller (EMC)" > > <emc-users@lists.sourceforge.net> > > To: "emc-users@lists.sourceforge.net" > > <emc-users@lists.sourceforge.net> Subject: [Emc-users] hostmot2 > > encoder latching > > > > I need to latch encoder counts at the edge of the index > > pulse. The hm2_7i92 encoder hal component has a > > "latch enable", "count-latched", and "latch-polarity" pins, > > which sound very promising. There is zero documentation > > on these as far as I can find. Looking at the source code, > > I am still confused, and wonder if I'm seeing a bug: > > > > do_flag( > > &hm2->encoder.control_reg[i], > > index_enable, > > HM2_ENCODER_LATCH_ON_INDEX > > ); > > > > do_flag( > > &hm2->encoder.control_reg[i], > > !index_enable && latch_enable, > > HM2_ENCODER_LATCH_ON_PROBE > > ); > > > > do_flag( > > &hm2->encoder.control_reg[i], > > index_enable || latch_enable, > > HM2_ENCODER_INDEX_JUSTONCE > > ); > > > > What I think I want is the INDEX_JUSTONCE mode, but > > the "index_enable || latch_enable" doesn't make sense > > to me. That would suggest that either index_enable or > > latch_enable pins would set this mode, Anybody (Jeff maybe?) > > care to clarify the functionality of this latching capability? > > > > It would be nice if the hostmot2 man page and web docs > > could be updated with these pins, which have been around > > for quite a while. > > > > Thanks, > > -- Ralph > > Unfortunately I dont think the latched position or count pins have > ever worked that is, the underlying hardware works (its used for > homing to index) but the driver does not calculate the proper latched > count or position values. There is a single count latch register so > any latch function must be shared with index. > > This would tend to discredit the method I used to determine the scale factors to use in my G0704 after I had put a 1000 line encoder on the motor, but left the old, opto-interrupter based index pulse wired to come from the home brewed encoder on the spindle. I rigged an index pulse counter that took an encoder position snapshot after just 3 full turns of the spindle, then took another snapshot at the 103rd point. Fed to a sum2 with one inputs gain set to -1 so it was a sub2. Then divided that output by 100 on a hand calculator. That became my high gear scale, which when it is in low gear is multiplied by the ratio since high to low wasn't exactly a 2/1 ratio.
But it does not attempt to reset or diddle the counter in the encoder, just take two snapshots and subtract the first from the 2nd to get the difference. And it certainly works with more than enough accuracy (2 digits to the right of the decimal point in a 7000+ count per rev) that I can do rigid tapping in either gear. I can insert that code into a message here if anyone is interested. Less than 100 LOC. > > Peter Wallace > Mesa Electronics -- Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users