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. On Fri, Nov 24, 2017, at 11:49 AM, Gene Heskett wrote: > On Friday 24 November 2017 11:04:16 Peter C. Wallace wrote: > > > Why dont you just make an index mark/pointer on the headstock and > > chuck This should be hand settable to less than a degree of chuck > > motion then just note the motor encoder count when the chuck is > > aligned with the mark and then rotate the motor until the chuck has > > turned say 20 turns. This should give you the ratio to within 1/7200 > > which should be better than needed. if thats not enough, just do more > > turns, you could get to PPM accuracy is less time than it takes to > > futz with doing this is hal > > > > Peter Wallace > > Mesa Electronics > > > That might be one way, Peter, and likely less time. But accessing the > motor shaft is going to be difficult, perhaps with pliers on the encoder > coupling. A bent wire in the chuck to use as a pointer. And running the > motor very slowly until that 20th is about to come up would greatly > simplicate that. Then just subtract the first raw-count from the last. > > Better yet would be a counter on the index and just let it run a while. > Then the question is how can I do that. I'll figure out something. That > is what gpio's are for... > > But first, transfer the wiring... > > ---------------------------------------------------------------------- > >-------- 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 > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/emc-users > > > 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 > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users -- John Kasunich [email protected] ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
