00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "extintf.h"
00027 #include "parport.h"
00028 #include "emcmot.h"
00029
00030
00031 #ifndef __GNUC__
00032 #ifndef __attribute__
00033 #define __attribute__(x)
00034 #endif
00035 #endif
00036
00037 static char __attribute__((unused)) ident[] = "$Id: extsmmot.c,v 1.4 2001/05/14 18:35:06 wshackle Exp $";
00038
00039 #define STEPPER_MAX 6
00040
00041
00042
00043
00044
00045 extern EMCMOT_DEBUG *emcmotDebug;
00046
00047 int extMotInit(const char * stuff)
00048 {
00049 if (0 != pptDioInit(0)) {
00050 return -1;
00051 }
00052
00053 return 0;
00054 }
00055
00056 int extMotQuit()
00057 {
00058 return pptDioQuit();
00059 }
00060
00061 int extDacNum()
00062 {
00063 return 0;
00064 }
00065
00066 int extDacWrite(int dac, double volts)
00067 {
00068 return 0;
00069 }
00070
00071 int extDacWriteAll(int max, double * volts)
00072 {
00073 return 0;
00074 }
00075
00076 int extEncoderSetIndexModel(unsigned int model)
00077 {
00078 return 0;
00079 }
00080
00081 int extEncoderNum()
00082 {
00083 return 0;
00084 }
00085
00086 int extEncoderRead(int encoder, double * counts)
00087 {
00088 if (encoder < 0 ||
00089 encoder >= STEPPER_MAX) {
00090 *counts = 0.0;
00091 }
00092 else {
00093 *counts = (double) emcmotDebug->stepperCount[encoder];
00094 }
00095
00096 return 0;
00097 }
00098
00099 int extEncoderReadAll(int max, double * counts)
00100 {
00101 int t;
00102
00103 for (t = 0; t < max; t++) {
00104 if (t >= STEPPER_MAX) {
00105 counts[t] = 0.0;
00106 }
00107 else {
00108 counts[t] = (double) emcmotDebug->stepperCount[t];
00109 }
00110 }
00111
00112 return 0;
00113 }
00114
00115 int extEncoderResetIndex(int encoder)
00116 {
00117 return 0;
00118 }
00119
00120 int extEncoderReadLatch(int encoder, int * flag)
00121 {
00122 *flag = 1;
00123
00124 return 0;
00125 }
00126
00127 int extEncoderReadLevel(int encoder, int * flag)
00128 {
00129 return 0;
00130 }
00131
00132 int extAmpEnable(int axis, int enable)
00133 {
00134 return 0;
00135 }
00136
00137 int extAmpFault(int axis, int * fault)
00138 {
00139 return 0;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 int extMaxLimitSwitchRead(int axis, int * flag)
00154 {
00155 if (axis < 0 || axis >= STEPPER_MAX) {
00156 *flag = 0;
00157 return 0;
00158 }
00159
00160 pptDioRead(0, flag);
00161
00162 return 0;
00163 }
00164
00165 int extMinLimitSwitchRead(int axis, int * flag)
00166 {
00167 if (axis < 0 || axis >= STEPPER_MAX) {
00168 *flag = 0;
00169 return 0;
00170 }
00171
00172 pptDioRead(1, flag);
00173
00174 return 0;
00175 }
00176
00177 int extHomeSwitchRead(int axis, int * flag)
00178 {
00179 if (axis < 0 || axis > STEPPER_MAX) {
00180 *flag = 0;
00181 return 0;
00182 }
00183
00184 pptDioRead(2, flag);
00185
00186 return 0;
00187 }
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197