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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 114
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 26
Publication 2098-PM001E-EN-P — July 2002
Programming Motion Control in C 1-15
Example 5 - A Gear Program
#include <motion.h>
#define ADCCHANNEL 1 /* Analog input chnl 1 */
/* This program uses analog input channel 1 to determine
the gearing ratio. The purpose of comparing the old ratio
to new is to avoid resetting the gear ratio when it has
not changed. */
int main (void)
{
float OldRatio, NewRatio;
InitMotionLibrary();
AxisEnable();
GearEnable();
OldRatio = 0;
while (!StopRequested())
{
NewRatio = AnalogInputGetVoltage(ADCCHANNEL);
if (NewRatio != OldRatio) {
GearSetRatio(NewRatio);
OldRatio = NewRatio;
}
}
GearDisable();
AxisDisable();
return 0;
}
Przeglądanie stron 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 113 114

Komentarze do niniejszej Instrukcji

Brak uwag