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

  • 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 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;
}
Zobrazit stránku 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 113 114

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

Žádné komentáře