00001 /* 00002 * $RCSfile: AO16_AnalogOutputSubsystem.hpp,v $ 00003 * $Revision: 1.6 $ 00004 * $Date: 2010/01/29 23:49:53 $ 00005 * jEdit:tabSize=4:collapseFolds=1: 00006 * 00007 * class AO16_AnalogOutputSubsystem declarations 00008 */ 00009 00010 #if ! defined( AO16_AnalogOutputSubsystem_hpp ) 00011 #define AO16_AnalogOutputSubsystem_hpp 00012 00013 // {{{ includes 00014 #include <AnalogOutputSubsystem.hpp> 00015 #include <AO16_OutputRange.hpp> 00016 #include <OutputVoltagePoint.hpp> 00017 // }}} 00018 00019 namespace AIOUSB { 00020 00027 class AO16_AnalogOutputSubsystem : public AnalogOutputSubsystem { 00028 friend class USB_AO16_Family; 00029 00030 // {{{ public constants 00031 public: 00032 /* 00033 * range codes passed to setRange(); these values are defined by the device and must not be changed 00034 */ 00036 static const int RANGE_0_5V = 0; // 0-5V 00037 00039 static const int RANGE_5V = 1; // +/-5V 00040 00042 static const int RANGE_0_10V = 2; // 0-10V 00043 00045 static const int RANGE_10V = 3; // +/-10V 00046 00048 static const int MIN_COUNTS = 0; 00049 00051 static const int MAX_COUNTS = 0xffff; 00052 // }}} 00053 00054 // {{{ protected members 00055 protected: 00056 static const char RANGE_TEXT[][ 10 ]; 00057 AO16_OutputRange outputRange; // device supports a single range for all D/A channels 00058 // }}} 00059 00060 // {{{ protected methods 00061 protected: 00062 AO16_AnalogOutputSubsystem( USBDevice &parent ); 00063 virtual ~AO16_AnalogOutputSubsystem(); 00064 // }}} 00065 00066 // {{{ public methods 00067 public: 00068 00069 /* 00070 * properties 00071 */ 00072 00073 static std::string getRangeText( int range ); 00074 00075 /* 00076 * configuration 00077 */ 00078 00085 int getRange() const { 00086 return outputRange.getRange(); 00087 } // getRange() 00088 00089 AO16_AnalogOutputSubsystem &setRange( int range ); 00090 AO16_AnalogOutputSubsystem &writeVolts( int channel, double volts ); 00091 AO16_AnalogOutputSubsystem &writeVolts( const OutputVoltagePointArray &points ); 00092 00101 double countsToVolts( unsigned short counts ) const { 00102 return outputRange.countsToVolts( counts ); 00103 } // countsToVolts() 00104 00113 unsigned short voltsToCounts( double volts ) const { 00114 return ( unsigned short ) outputRange.voltsToCounts( volts ); 00115 } // voltsToCounts() 00116 00117 // }}} 00118 00119 }; // class AO16_AnalogOutputSubsystem 00120 00121 } // namespace AIOUSB 00122 00123 #endif 00124 00125 /* end of file */