Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manual de usuario Pagina 27

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 114
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de 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;
}
Vista de pagina 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 113 114

Comentarios a estos manuales

Sin comentarios