Professional Documents
Culture Documents
XY Interpolation Algorithms PDF
XY Interpolation Algorithms PDF
ALGORITHMS
Kenneth and Melvin Goldberg
3913 Pine Street, Apt. F
Philadelphia, Pennsylvania 19104
A microcomputer can be used to of microcomputers. Since these in C for fast execution, portability,
control the motion of numerical con- algorithms do not require a large and ease of modification. The pro-
trol machines. This article describes a amount of complex mathematical gram, as shown, does not actually
straightforward method for approx- calculation, they are fast enough to control any stepping motors; rather,
imating diagonal lines and circular be used in real-time applications. The it provides a screen display consisting
motion on an XY plane. program shown in listing 1 is written of + 1, -1, and O.In an actual control
Many numerical control machines
are powered by stepping motors.
Listing 1.
When a pulse is sent to a stepping
motor, the stepping motor alters its 1 f********************************************************f
position by a unit step. Two motors 2: f* PROGRAt1 STEER *f
can be used to control the XY move- 3: f* (C)M.M. and K.Y. GOLDBERG *f
4: f* This Numerical Control Program uses linear *f
ments of an arm or tool over a work- 5: f* interpolation to provide a flow of output *f
6: f* pulses which can be used to steer an xy table *f
ing plane. 7: f**********************************************************f
8: #include <bdscio.h> f* micro 'c' function package *f
If the pulses are generated by a 9:
10: char templ[5],temp2[5],temp3[5],temp4[5],temp5[5],
device which can remember or 11: char eia[lO],
12 : int feedrate,drag,oil, f* vars dealing with feedrate and delay func. *f
generate a specified train of pulses, 13: int xl,yl, f* starting point *f
14: int x2,y2,
repetitive operations such as grind- 15: int x3,y3,
f* relative position *f
f* endpoint *f
ing, painting, or cutting can be per- 16 : int xo,yo, f* direction of output: +1, -I, or 0 *f
17: int dX,dy, f* differentials of x and y *f
formed hundreds of times with vir- 18: int stepnum,
19 : int fxy, f* value of function *f
tually no variation. A microcomputer 20:
21: int rad,radrad,f,a,b,d,
is an obvious choice to generate and 22: main(argc,argv)
remember the pulses. 23:
24:
int argc,
char *argv[],
Since stepper motors can move on- 25: [
26 : printf(" STI3ER: A llUMr::RICALCONTROL PROGRAM\n"),
ly in discrete steps, we must approx- 27: printf("\nInput Command line (ie, 'GOl (0,0,10,20) 100')\n: "),
imate the actual curve by a series of 28:
29 :
scanf ("%s (~s, %s, %s, %s) %s", eia, tempI. temp2, temp3, temp4, tempS) ,
feedrate ~ atoi(temp5),
small XY motions. Many algorithms 30:
31:
xl ~ atoi(templ),
yl ~ atoi(temp2),
rely upon parametric functions such 32: x3 ~ atoi(temp3),
33: y3 ~ atoi(temp4),
as sine and cosine to perform the 34:
35:
necessary calculations. Parametric 36:
if ( ! strcmp (eia, "GOI
else docircle(),
" ) ) doline () ,
.
,...---