On Friday 24 November 2017 12:11:02 John Kasunich wrote: > I'm with Peter that manual turning is simpler. But if you can't turn > it manually, here is a simple HAL approach. This takes advantage of > the fact that a mux2 with its output fed back to one input acts like a > sample- and-hold circuit. > > Set up one channel of your 5i20 or whatever to count the motor > encoder, using quadrature as normal. Do NOT connect the index enable, > treat it as a pure 2-phase encoder without index. > > Set up another counter (either hardware or software) in counter mode > to count index pulses only on the spinde. > > Set up two comparator components and two mux2's in HAL. > > Both comparators are looking at the spindle count. The first > comparator has a threshold of say 1.5 counts. So it's ouput will > change state as the second index pulse increments the spindle count > from 1 to 2. > The second comparator has a theshold of 21.5, so its output will > change state as the spindle count increments from 21 to 22. > > Connect the sel input of each mux2 to the corresponding comparator > output. Connect the motor position to one input of each mux2, and > connect the other input of each mux2 to its own output. > > Run the spindle slowly enough that the index pulse is detectable by > whatever you are using to count it. > > When you start out with the spindle position at zero (or negative), > both mux2's will be feeding the motor position (first input) to the > output, and both outputs will track the motor. When spindle count > ticks from 1 to 2, the first mux will switch from tracking the motor > to holding its own current value. When the spindle ticks from 21 to > 22, the second mux will do the same. The difference between the two > captured values divided by 20 is the scale you are looking for. > I'll do that John, as I had something similar in mind already, but first I need to eviscerate the opto's in those two inputs, they are about 2 decades too slow, and the a/b inputs on the 5i25 side of the bob disappear at around 100 spindle revs. With the pid's still active, the spindle takes off, and the encoder stops counting.
If Peter doesn't have something like cnc4pc's c10s, thats next. But its going to be a project to do that as its pretty well buried in that box. Thanks John. 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