lib/PCI-6205.hh
00001 // PCI-6205蜈・蜃コ蜉帙け繝ゥ繧ケ
00002 // 2011/02/09 Yuki YOKOKURA
00003 //
00004 // Interface遉セ陬スPCI-6205縺ョ縺溘a縺ョ蜈・蜃コ蜉帶ゥ溯�ス繧呈署萓帙@縺セ縺吶��
00005 //
00006 // Copyright (C) 2011 Yuki YOKOKURA
00007 // This program is free software;
00008 // you can redistribute it and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 3 of the License, or any later version.
00010 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
00011 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00012 // See the GNU General Public License for more details <http://www.gnu.org/licenses/>.
00013 // Besides, you can negotiate about other options of licenses instead of GPL.
00014 // If you would like to get other licenses, please contact us<yuki@katsura.sd.keio.ac.jp>.
00015 
00016 #ifndef PCI6205
00017 #define PCI6205
00018 
00019 #include <sys/io.h>
00020 #include <unistd.h>
00021 #include <algorithm>
00022 
00023 namespace ARCS {        // ARCS蜷榊燕遨コ髢�
00024         class ENC6205 {
00025                 private:
00026                         static const unsigned int MAX_CH=8;                             // 繝√Ε繝阪Ν譛�螟ァ蛟、
00027                         unsigned int BaseAddr[4];                                               // 蜈磯�ュ繧「繝峨Ξ繧ケ
00028                         double Resolutions[MAX_CH];                                             // [m] 繧ィ繝ウ繧ウ繝シ繝�蛻�隗」閭ス
00029                         void Settings(void);                                                    // 繧ィ繝ウ繧ウ繝シ繝�繧ォ繧ヲ繝ウ繧ソ縺ョ險ュ螳壹r陦後≧髢「謨ー
00030                         void Input(unsigned long ENCdata[MAX_CH]);              // 繧ィ繝ウ繧ウ繝シ繝�繧ォ繧ヲ繝ウ繧ソ縺九i繧ォ繧ヲ繝ウ繝亥�、繧定ェュ縺ソ霎シ繧�髢「謨ー
00031                         void Zero(void);                                                                // 繧ィ繝ウ繧ウ繝シ繝�繧ォ繧ヲ繝ウ繧ソ縺ョ蛟、繧帝峺(0x800000)縺ォ縺吶k髢「謨ー
00032                         // 繧ィ繝ウ繧ウ繝シ繝�繧ォ繧ヲ繝ウ繧ソ蛟、縺九i菴咲スョ[m]縺ク螟画鋤縺吶k髢「謨ー
00033                         double EncDataToPosition(unsigned long EncData, unsigned int ch);
00034                         // 荳贋ス阪�∽クュ菴阪�∽ク倶ス阪↓蛻�縺九l縺ヲ縺�繧句推縲�1繝舌う繝医�ョ繝�繝シ繧ソ繧偵��3繝舌う繝医�ョ繝�繝シ繧ソ縺ォ邨仙粋縺吶k髢「謨ー
00035                         unsigned long IIIbyteCat(unsigned short High, unsigned short Middle, unsigned short Low);
00036                 
00037                 public:
00038                         ENC6205(const int Base[4], const double EncResolutions[MAX_CH]);        // 繧ウ繝ウ繧ケ繝医Λ繧ッ繧ソ(ENC蛻晄悄蛹厄シ�險ュ螳�)
00039                         ~ENC6205();                                                                                                                     // 繝�繧ケ繝医Λ繧ッ繧ソ(ENC邨ゆコ�蜃ヲ逅�)
00040                         void GetPositionRes(volatile double Xres[MAX_CH]);                                      // 菴咲スョ蠢懃ュ泌�、繧偵き繧ヲ繝ウ繧ソ縺九i蜈・蜉�
00041         };
00042 }
00043 
00044 #endif
00045 
00046 
00047 
 All Classes Files