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

encoder.h

Go to the documentation of this file.
00001 #ifndef ENCODER_H
00002 #define ENCODER_H
00003 
00004 /*
00005    encoder.h
00006 
00007    Encoder declarations
00008 
00009    An encoder converts shaft or scale position to counts. If
00010    calibrating, calls to getCounts() with the position at which the
00011    index pulse occurs will reset the counts value to 0. Index pulses
00012    "occur" when the position passed to getCounts is a multiple of
00013    2 PI.
00014 
00015    Modification history:
00016 
00017    14-Apr-2000 WPS added _attribute__((unused)) to encoder_h
00018    17-Mar-1998  FMP added section arg to encoderIniLoad()
00019    18-Dec-1997  FMP took out C++ interface
00020    16-Jun-1997  FMP added index
00021    24-Apr-1997  FMP added encoderIniLoad(); removed inifile
00022    17-Apr-1997  FMP split into C and C++ portions
00023 */
00024 
00025 /* ident tag */
00026 #ifndef __GNUC__
00027 #ifndef __attribute__
00028 #define __attribute__(x)
00029 #endif
00030 #endif
00031 
00032 
00033 static char __attribute__((unused)) encoder_h[] = "$Id: encoder.h,v 1.2 2000/10/27 20:34:42 terrylr Exp $";
00034 
00035 typedef struct
00036 {
00037   /* parameters */
00038   int countsPerRev; /* counts per motor shaft revolution */
00039 
00040   /* internal vars */
00041   int configured;
00042   int counts;
00043   int calibrating;
00044   double offset;
00045   double lastPosition;
00046   int index;                    /* count where index pulse was */
00047 
00048 } ENCODER_STRUCT;
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053 
00054 extern int encoderInit(ENCODER_STRUCT * enc);
00055 extern int encoderSetCountsPerRev(ENCODER_STRUCT * enc, int countsPerRev);
00056 extern int encoderGetCountsPerRev(ENCODER_STRUCT * enc);
00057 extern int encoderGetCounts(ENCODER_STRUCT * enc, double position);
00058 extern int encoderCalibrate(ENCODER_STRUCT * enc);
00059 extern int encoderNoCalibrate(ENCODER_STRUCT * enc);
00060 extern int encoderIsCalibrating(ENCODER_STRUCT * enc);
00061 extern int encoderIniLoad(ENCODER_STRUCT * enc, const char * filename, const char *section);
00062 
00063 #ifdef __cplusplus
00064 }
00065 #endif
00066 
00067 #endif /* ENCODER_H */

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