Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

dcmotor2test.c

Go to the documentation of this file.
00001 
00002 #include <stdio.h>
00003 #include <string.h>
00004 #include <stdlib.h>
00005 
00006 #ifdef USE_DCMOTOR2
00007 #include "dcmotor2.h"
00008 #else
00009 #include "dcmotor2.h"
00010 #endif
00011 
00012 DC_MOTOR_STRUCT dcm;
00013 int  skip_cycles=0;
00014 double cycle_time=0.1;
00015 
00016 int main(int argc, const char **argv)
00017 {
00018   int i = 0;
00019   if(argc > 1)
00020     {
00021       cycle_time=strtod(argv[1],0);
00022     }
00023   if(argc > 2)
00024     {
00025       skip_cycles=strtol(argv[2],0,0);
00026       if(skip_cycles > 0)
00027         {
00028           cycle_time = cycle_time/(skip_cycles+1);
00029         }
00030     }
00031   dcmotorInit(&dcm);
00032   dcmotorSetCycleTime(&dcm, cycle_time);
00033   dcmotorIniLoad(&dcm,"sim.ini","AXIS_0");
00034   dcmotorSetCycleTime(&dcm, cycle_time);
00035   dcmotorSetParameters(&dcm, dcm);
00036 
00037   while(1)
00038     {
00039       for(i = 0; i < skip_cycles; i++)
00040         {
00041           dcmotorRunCycle(&dcm,1.0);
00042         }
00043       printf("%f\n",dcmotorRunCycle(&dcm,1.0));
00044     }
00045 
00046 }

Generated on Sun Dec 2 15:27:36 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001