00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef CDriverServotogoH
00023 #define CDriverServotogoH
00024 
00025 #include "devices/CGenericDevice.h"
00026 
00027 #if defined(_ENABLE_SERVOTOGO_DEVICE_SUPPORT)
00028 
00029 
00030 
00038 
00039 
00040 
00041 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00042 
00043 
00044 
00045 
00046 
00047 
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051 
00052 #define DLPORT_API _stdcall
00053 
00054 unsigned char DLPORT_API
00055 DlPortReadPortUchar(
00056     IN unsigned long Port
00057     );
00058 
00059 unsigned short DLPORT_API
00060 DlPortReadPortUshort(
00061     IN unsigned long Port
00062     );
00063 
00064 unsigned long DLPORT_API
00065 DlPortReadPortUlong(
00066     IN unsigned long Port
00067     );
00068 
00069 void DLPORT_API
00070 DlPortReadPortBufferUchar(
00071     IN unsigned long Port,
00072     IN unsigned char* Buffer,
00073     IN unsigned long  Count
00074     );
00075 
00076 void DLPORT_API
00077 DlPortReadPortBufferUshort(
00078     IN unsigned long Port,
00079     IN unsigned short* Buffer,
00080     IN unsigned long Count
00081     );
00082 
00083 void DLPORT_API
00084 DlPortReadPortBufferUlong(
00085     IN unsigned long Port,
00086     IN unsigned long* Buffer,
00087     IN unsigned long Count
00088     );
00089 
00090 void DLPORT_API
00091 DlPortWritePortUchar(
00092     IN unsigned long Port,
00093     IN unsigned char Value
00094     );
00095 
00096 void DLPORT_API
00097 DlPortWritePortUshort(
00098     IN unsigned long Port,
00099     IN unsigned short Value
00100     );
00101 
00102 void DLPORT_API
00103 DlPortWritePortUlong(
00104     IN unsigned long Port,
00105     IN unsigned long Value
00106     );
00107 
00108 void DLPORT_API
00109 DlPortWritePortBufferUchar(
00110     IN unsigned long Port,
00111     IN unsigned char* Buffer,
00112     IN unsigned long  Count
00113     );
00114 
00115 void DLPORT_API
00116 DlPortWritePortBufferUshort(
00117     IN unsigned long Port,
00118     IN unsigned short* Buffer,
00119     IN unsigned long Count
00120     );
00121 
00122 void DLPORT_API
00123 DlPortWritePortBufferUlong(
00124     IN unsigned long Port,
00125     IN unsigned long* Buffer,
00126     IN unsigned long Count
00127     );
00128 
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132 
00133 
00134 
00135 
00136 typedef union
00137 {
00138     unsigned long                       all;
00139     struct {unsigned char  A, B, C, D;} port;
00140 } IO32;
00141 
00142 
00143 typedef union
00144 {
00145     long           Long;
00146     unsigned char  Byte[4];
00147 } LONGBYTE;
00148 
00149 
00150 typedef union
00151 {
00152     unsigned short                          Word;
00153     struct   {unsigned char    high, low;}  Byte;
00154 } WORDBYTE;
00155 
00156 
00157 #endif  // DOXYGEN_SHOULD_SKIP_THIS
00158 
00159 
00160 
00168 
00169 class cDriverServotogo : public cGenericDevice
00170 {
00171   public:
00172     
00173     
00174     
00175 
00177     cDriverServotogo();
00178 
00180     ~cDriverServotogo();
00181 
00182 
00183     
00184     
00185     
00186 
00188     virtual int open();
00189 
00191     virtual int close();
00192 
00194     virtual int initialize(const bool a_resetEncoders=false);
00195 
00217     virtual int command(int a_command, void* a_data);
00218 
00219   private:
00220 
00221     
00223     
00224     
00226     long m_homeposition[20];
00227 
00229     unsigned short m_wBaseAddress;
00230 
00232     unsigned short m_wIrq;
00233 
00235     unsigned short m_wModel;
00236 
00238     unsigned short m_wNoBoardFlag;
00239 
00241     unsigned short m_wAxesInSys;
00242 
00244     unsigned short m_wSaveDirs;
00245 
00247     unsigned char  m_byIndexPollAxis;
00248 
00250     unsigned char  m_byIndexPulsePolarity;
00251 
00252 
00253     
00254     
00255     
00256 
00258     void setDac(int a_num, double a_volts);
00259 
00261     int getEncoder(int a_num, long *a_value);
00262 
00264     unsigned short brdtstOK(unsigned short a_baseAddress);
00265 
00267     void stg_Init(unsigned short a_wAdd);
00268 
00270     void encoderInit();
00271 
00273     void encoderLatch();
00274 
00276     unsigned short findBaseAddress();
00277 
00279     void encReadAll(LONGBYTE * a_lbEnc);
00280 
00282     void rawDAC(unsigned short a_nAxis, long a_lCounts);
00283 
00285     int getBaseAddress();
00286 };
00287 
00288 
00289 #endif
00290 
00291 #endif //_ENABLE_SERVOTOGO_DEVICE_SUPPORT
00292 
00293