Main Page | Data Structures | File List | Data Fields | Globals

mechanism.h

Go to the documentation of this file.
00001 #ifndef MECHANISM_H 00002 #define MECHANISM_H 00003 00004 // 00005 // mechanism.h - mechanism parameter table header 00006 // 00007 00022 // System header files 00023 00024 #include <stdio.h> 00025 #include <string.h> 00026 #include <stdlib.h> 00027 #include <unistd.h> 00028 #include <errno.h> 00029 #include <sys/time.h> 00030 #include <sys/times.h> 00031 #include <sys/types.h> 00032 #include <sys/socket.h> 00033 #include <sys/file.h> 00034 #include <netdb.h> 00035 #include <netinet/in.h> 00036 #include <arpa/inet.h> 00037 #include <time.h> 00038 #include <termios.h> 00039 #include <fcntl.h> 00040 #include <signal.h> 00041 00042 #include "siutils.h" // SiUtils API header file 00043 00044 //---------------------------------------------------------------- 00045 // 00046 // si_mechanism: microstep drive configuration struct 00047 // 00048 00049 00063 typedef struct si_mechanism { 00064 00065 // Mechanism info 00066 char Name[64]; 00067 int Topology; 00068 int Resolution; 00069 00070 // Serial Communications Parameters: 00071 char Port[64]; 00072 int FD; 00073 long Timeout; 00074 long Polltime; 00075 00076 // Mechanism Motion Profile: 00077 int State; 00078 int Accel; 00079 double Speed; 00080 int Distance; 00081 int Decel; 00082 double Current; 00083 double IdleCurrent; 00084 int Idle; 00085 00086 // Input sensor parameters 00087 char Inputs[SI_MAXINPUTS+1]; 00088 char ISmask[SI_MAXINPUTS+1]; 00089 00090 // Indexed Position Encoding (inputs as position encoders) 00091 int NPos; 00092 int Offset; 00093 int StepPos; 00094 int NData; 00095 int EncPos; 00096 int InPosAddr; 00097 int InPos; 00098 int OccupiedAddr; 00099 int Occupied; 00100 00101 // Absolute Mechanism Position (device step counts) 00102 int HomeAddr; 00103 int AtHome; 00104 int Position; 00105 int StepsPerMM; 00106 00107 // Limit switch parameters 00108 int Limits; 00109 int CWlimit; 00110 int CCWlimit; 00111 00112 // Motor Brake parameters 00113 int BrakeAddr; 00114 int Brake; 00115 00116 // Other parameters 00117 int Debug; 00118 int Abort; 00119 00120 } si_mechanism_t; 00121 00122 // Drive Parameter definitions 00123 00124 #define MECH_ROTARY 1 00125 #define MECH_LINEAR 2 00126 00127 // Limit switch settings 00128 00129 #define MECH_NOLIMITS 0 00130 #define MECH_NORMALLY_CLOSED 1 00131 #define MECH_NORMALLY_OPEN 2 00132 00133 // Default parameter values 00134 00135 #define MECH_TIMEOUT 10L 00136 #define MECH_POLLTIME 50L 00137 00138 // Return Code 00139 00140 #define MECH_OK 0 00141 #define MECH_ERR -1 00142 00143 // Mechanism Brake State 00144 00145 #define MECH_SET_BRAKE 1 00146 #define MECH_RELEASE_BRAKE 0 00147 00148 // Mechanism Function Prototypes 00149 00150 void MechInitTable(si_mechanism_t *); 00151 int MechGetPos(si_mechanism_t *, char *); 00152 int MechSetProfile(si_mechanism_t *, char *); 00153 int MechMoveAbs(si_mechanism_t *, int, char *); 00154 int MechMoveRel(si_mechanism_t *, int, char *); 00155 int MechMoveTo(si_mechanism_t *, int, int, char *); 00156 int MechFindPos(si_mechanism_t *, char *); 00157 int MechBrake(si_mechanism_t *, int, char *); 00158 // int MechHome(si_mechanism_t *, char *); 00159 void MechAbort(si_mechanism_t *); 00160 00161 // Convenience Functions 00162 00163 int MechEncToDev(int, int, int, int); 00164 00165 #endif // MECHANISM_H

Generated on Mon Jul 19 16:32:37 2004 for Si Microstep Controller API by doxygen 1.3.7