Let's see.

Spindle at 600 RPM is 10 RPS.  That means a 200 line encoder not using 
quadrature and only a rising edge is generating 2000 pulses per second or 4000 
edges per second.  That's because to detect a rising edge you also have to 
detect that it went low.  

That means the hardware has to be looking at those edges at probably twice that 
rate.  I don't know how the MESA hardware is capturing those signals.

One way is to have a high speed counter value that is latched on each rising 
edge.  This value could be added to the previous values until passed up to the 
Servo Thread along with the number of rising edges. Passed up the current value 
is cleared.  So your servo thread is getting the time (so to speak) between 
encoder rising edges.  

If your servo thread is 1mS you'd see sum of two updates.  If the counter is 
clocked at 1MHz then each encoder pulse count  is 500.  Total is 1000 for two 
or still 500 pulses between rising edges.  If the requested speed is 500 clocks 
per encoder pulse then subtracting that count gives you the 'E'rror term for 
the PID.  Zero in this example.

That's just one way to do it.  

John






> -----Original Message-----
> From: Dan Henderson [mailto:luvtof...@gmail.com]
> Sent: May-05-20 3:31 PM
> To: Enhanced Machine Controller (EMC)
> Subject: Re: [Emc-users] Fluctuating RPM using CUI ATM 10 encoder
> 
> Gene, how do I speed up the servo loop to test your theory? I�ll try that
> before I perform surgery on the BOB. I also have another BOB I can try, but
> it requires 12-24v power in order to enable its inputs.
> 
> On Tue, May 5, 2020 at 5:07 PM Gene Heskett <ghesk...@shentel.net> wrote:
> 
> > On Tuesday 05 May 2020 17:48:01 Dan Henderson wrote:
> >
> > > I have a PMDC motor I�ve scavenged along with the MC-2100 motor
> > > control from a treadmill rated for 1.5 hp @ 90 volts. I�ve been
> > > testing it with LinuxCNC v2.7.15 in a mock-up environment I built for
> > > testing. I�m able to control the spindle speed via PWM pulses to the
> > > controller (HD2 pin 4). M3 S500 will get me somewhere between 520 and
> > > 580 rpm. You can hear the motor whine fluctuating with the RPM. I�ve
> > > also installed a CUI ATM 10 encoder on the back and seem to have it
> > > working with both an index and phase A signal. I have the jumpers on
> > > it set to 200 PPR but it can go all the way to 2048. I�m using a cheap
> > > china 5 axis BOB connected via parallel cable.
> > >
> > > Does anybody have any idea why I�m get so much flux on the rpm? Surely
> > > this isn�t normal? I know enough about the HAL to be dangerous. Is
> > > there some things I can check to smooth this out? Thanks.
> > >
> > If using a software encoder, as opposed to a mesa card, the time delay
> > between samples at the 1 kilohertz servo loop can do odd things.  Among
> > others, the lag in the input opto-isolators of that bob can even cause
> > missed pulses from the encoder to the software. Try a much lower speed
> > to see if it stabilizes.  If handy with a soldering iron, bypassing
> > those opto's can help, a lot.
> > > _______________________________________________
> > > Emc-users mailing list
> > > Emc-users@lists.sourceforge.net
> > > 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)
> > If we desire respect for the law, we must first make the law respectable.
> >  - Louis D. Brandeis
> > Genes Web page <http://geneslinuxbox.net:6309/gene>
> >
> >
> > _______________________________________________
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> 
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to