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.
>
That will be an updown => S32_float => comp0 comp1 that will drive the 
mux2.sel's. The updown will be driven from the 5i25's gpio 16, the raw 
input from the existing encoders index.

But sitting here thinking as I edit the hal file, (I can get into all 
sorts of trouble doing that) the encoders position value is determined 
by the existing scale factor I believe, so in the final calculation this 
existing scale has to be factored out by multiplying the subtractions 
result by the existing scale factor to get the new scale factor.  If I 
set it to 10,000, then the pid's will be a lot happier while this is 
going on.  My experiments so far have consisted of removing the decimal 
point from the original 264.0, and thats obviously from the way it 
starts, still way too low. Lots of startup overshoot till the IPgain 
kicks in and slows it back down.

Am I correct in my thinking on the position output being determined by 
the scale in effect at the time of the test?  Or should I be using count 
or rawcount. But counts is reset at index, and rawcounts would require 
it be run backwards to setup for the 2nd gear test and is not effected 
by a reset. But using rawcounts would also give me the exact scale 
regardless of the existing scale when the test is run.  I think...

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

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

Reply via email to