Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Uživatelský manuál Strana 26

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 114
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 25
Publication 2098-PM001E-EN-P — July 2002
1-14 Programming Motion Control in C
Example 4 - A Jog Program
#include <motion.h>
#define JOGREVERSE 7 /* Input 7 */
#define JOGFORWARD 8 /* Input 8 */
#define ACCDEC 10000 /* counts/second**2 */
#define JOGVEL 20000 /* counts/second */
#define STOPPED 0 /* Jog modes */
#define FORWARD 1
#define REVERSE 2
/* This program uses inputs 7 and 8 to Jog the axis in the
reverse and forward direction, respectively. It will
continue to run until a Stop or Kill command is issued from
Ultraware. */
int main (void)
{
long Jogging;
InitMotionLibrary();
AxisEnable();
JogSetAcc(ACCDEC);
JogSetVel(JOGVEL);
JogSetDec(ACCDEC);
while (!StopRequested())
{
Jogging = JogGetMode();
if (!JogInProgress()) {
if (InputGetState(JOGREVERSE) == ON)
JogReverse();
else if (InputGetState(JOGFORWARD) == ON)
JogForward();
}
else if (((InputGetState(JOGREVERSE) == OFF) &&
(Jogging == REVERSE)) ||
((InputGetState(JOGFORWARD) == OFF) &&
(Jogging == FORWARD)))
JogStop();
}
AxisDisable();
return 0;
}
Zobrazit stránku 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 113 114

Komentáře k této Příručce

Žádné komentáře