Cnc mill cutting a circle and wondering if prop can handle negative numbers
science_geek
Posts: 247
i have recently built a 3 axis cnc mill, i can get it to draw squares like theres no tomorrow. i am using 3 easy step v3 stepper motor controllers from sparkfun so that it only requires a pulse to move it. i was wondering if anyone knew of an algorithm to get the prop to plot a cirlce, also is it possible for the prop to understand and use a negative value,·or if anyone has done something like this any help/advice is VERY welcome.
Comments
The Propeller can deal with negative numbers, as can every other MCU. See the manual.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
en.wikipedia.org/wiki/Midpoint_circle_algorithm
en.wikipedia.org/wiki/Bresenham's_line_algorithm for lines
The original one is for drawing lines, but there is also one for drawing circles.
In general the Bresenham algorithms are based on integer math and will give you a decision on which step to do next, up/down/left/right. That's what you need for your steppers.
Negative numbers are directly supported by SPIN. In PASM it simply depends on which instructions you use. There are instructions for signed numbers and instruction for unsigned numbers.
Jim
Since the CNC mill doesn't go very fast you can use Spin for the coding, which has multiplication and division to do the scaling. (I have tested this, and multiplication isn't any slower than addition in Spin; the overhead of the interpreter dwarfs the overhead of the multiply subroutine in the interpreter.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys