Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Instrukcja Użytkownika Strona 17

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 114
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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;
}
Przeglądanie stron 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 113 114

Komentarze do niniejszej Instrukcji

Brak uwag