> -----Original Message-----
> From: Chris Albertson [mailto:albertson.ch...@gmail.com]
> Sent: April-28-20 9:30 PM
> To: Enhanced Machine Controller (EMC)
> Subject: Re: [Emc-users] A simple LinuxCNC system
> 
> On Tue, Apr 28, 2020 at 6:32 PM John Dammeyer <jo...@autoartisans.com>
> wrote:
> 
> >
> > Will you share some code on how you accelerate from 0 to 15kHz stepping
> > rate on your $1 processor?
> >
> 
> No code. that is the entire point.  The microcontroller has built-in
> hardware the bigger PC or Raspberry Pi lacks.   

>      But at the servo loop
> period you would re-oad the register with the new step period.      The
> resolution is hat ever is needed up to the crystal frequency.
> 
> Same with reading quadrature encoders.  The chips will have a hardware
> encoder made with flip-flops and a counter. So there is no polling or
> iterrupts.  They use logic gates.  The software reads the encoder value
> from a hardware register.   To the little chip and drive a few motors I
> might do a 20Hz loop but run the motor at 1KHz.
> 
> LinuxCNC with a Mesa card works sort of like this too.  An FPGA is just
> hardware gates
> 
> 
HI Chris,
I believe you indirectly answered my question.    To say it differently I'd 
explain it this way.

The trajectory planner decides that a motor needs to step at rate N.  So as you 
said the " servo loop period " does the calculation and sets that up.  In the 
case of the parallel port interface the real time system runs at the 
BASE_PERIOD rate to generate these pulses.   And there's an embedded delay loop 
in the reset_port() function called from somewhere.  Don't know where yet.

In either case, how the steps are generated when you use something external 
like a $1 chip or an FPGA is what I was trying to leave out of this 
conversation.

If the SERVO_PERIOD is 1kHz (1mS) then a new rate is calculated and sent off to 
the stepping task.  But you can't just step at a new rate.  The trajectory 
planner has to determine the acceleration and for each SERVO_PERIOD issue a new 
step rate so that the motor accelerates up to or down to the new speed.  

Here's my question for you.  If the asynchronous pulse generator from your $1 
chip has just created a pulse and the SERVO_PERIOD now wants to a new rate how 
do you set up the frequency generator so that the next pulse is correctly 
spaced from the previous one?  Or do you just hope it works out?

John




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

Reply via email to