Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manuale Utente Pagina 27

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 114
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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;
}
Vedere la pagina 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 113 114

Commenti su questo manuale

Nessun commento