Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manual de usuario Pagina 17

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 114
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 16
Publication 2098-PM001E-EN-P — July 2002
Programming Motion Control in C 1-5
Variables, Loops, and Constants
The next example is a motion program that makes a series of 10 index
moves of 1000 counts each. This program introduces you to:
Comments
Declarations
Variables
Arithmetic expressions
Loops
Example 2.1 - A Motion Program Using Variables
Enter the following program into a source file using the same process
as Example 1.
#include <motion.h>
/* increment through the 10 index positions
1000, 2000,..., until target > endpoint */
int main (void)
{
long target, index, endpoint;
InitMotionLibrary();
AxisEnable();
MoveSetAcc(1000);
MoveSetVel(1000);
MoveSetDec(1000);
AxisDefinePos(0); /* define current position as
index = 1000; 0 */
target = index; /* initialize target to first
index position (1000) */
endpoint = index * 10; /* initialize endpoint to
10000 (1000 * 10) */
while (target <= endpoint) {
MoveAbsolute(target);
while (MoveInProgress()) {/* loop */}
target = target+index;
}
AxisDisable();
return 0;
}
Vista de pagina 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 113 114

Comentarios a estos manuales

Sin comentarios