Welcome! Log In Create A New Profile

Advanced

how it works?

Posted by applepear 
how it works?
April 29, 2014 12:06PM
Hello,

im wondering, how a driver board generally work. How does it synchronies the 4 steppers an drive them?
I've tried to write a script wich synchronize them by using the least common multiplier. But when the numbers were very different, it slows down.
So could please explain me how it drives them simultaneous without slowing down.
Re: how it works?
May 01, 2014 07:26AM
To get a synchonized movement you simply send a step pulse to each stepper at (almost) the same time. Like:
for ( ; ; ) {
  set_x_step_high();
  set_y_step_high();
  delay_microseconds(2); // or do some calculations
  set_x_step_low();
  set_y_step_low();
  delay_milliseconds(5);
}

Synchonizing unconditionally always gives you 45 deg moves, of course. To deal with non-45 deg moves, the Bresenham algorithm is used. Originally written for pixel rendering, it applies to stepper motors, too, if you think of a step as being a pixel.

You can find a pretty straightforward real-world implementation of the above in Teacup firmware, file dda.c. Stepping is done in dda_step(), speed calculations are done in dda_start(), acceleration calculations and endstop handling in dda_clock().


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: how it works?
May 01, 2014 07:46AM
Or you can get even more creative and put all the step lines on a single 8 bit port and tell all the ones you want to step at the same time by setting the apropriate bit pattern and writing that byte (depends on if mpu can do this)

Do any boards actuly do this?, I dont know....
Sorry, only registered users may post in this forum.

Click here to login