AIOUSB::DA12_AnalogOutputSubsystem Class Reference

#include <DA12_AnalogOutputSubsystem.hpp>

Inheritance diagram for AIOUSB::DA12_AnalogOutputSubsystem:

Inheritance graph
[legend]
Collaboration diagram for AIOUSB::DA12_AnalogOutputSubsystem:

Collaboration graph
[legend]

List of all members.

Public Member Functions

int getRange (int channel) const
IntArray getRange (int startChannel, int numChannels) const
DA12_AnalogOutputSubsystemsetRange (int channel, int range)
DA12_AnalogOutputSubsystemsetRange (int startChannel, const IntArray &range)
DA12_AnalogOutputSubsystemsetRange (int range)
DA12_AnalogOutputSubsystemwriteVolts (int channel, double volts)
DA12_AnalogOutputSubsystemwriteVolts (const OutputVoltagePointArray &points)
double countsToVolts (int channel, unsigned short counts) const
unsigned short voltsToCounts (int channel, double volts) const

Static Public Member Functions

static std::string getRangeText (int range)

Static Public Attributes

static const int RANGE_0_2_5V = 0
static const int RANGE_2_5V = 1
static const int RANGE_0_5V = 2
static const int RANGE_5V = 3
static const int RANGE_0_10V = 4
static const int RANGE_10V = 5
static const int MIN_COUNTS = 0
static const int MAX_COUNTS = 0xfff

Protected Member Functions

 DA12_AnalogOutputSubsystem (USBDevice &parent)
virtual ~DA12_AnalogOutputSubsystem ()

Protected Attributes

DA12_OutputRangeoutputRange

Static Protected Attributes

static const char RANGE_TEXT [][10]

Friends

class USB_DA12_8A_Family
class USB_DA12_8E_Family


Detailed Description

Class DA12_AnalogOutputSubsystem represents the analog output subsystem of a device. One accesses this analog output subsystem through its parent object, typically through a method such as dac() (see USB_DA12_8E_Family::dac()).

Constructor & Destructor Documentation

AIOUSB::DA12_AnalogOutputSubsystem::DA12_AnalogOutputSubsystem ( USBDevice parent  )  [protected]

AIOUSB::DA12_AnalogOutputSubsystem::~DA12_AnalogOutputSubsystem (  )  [protected, virtual]


Member Function Documentation

double AIOUSB::DA12_AnalogOutputSubsystem::countsToVolts ( int  channel,
unsigned short  counts 
) const

Converts a single D/A count value to volts, based on the current range setting.

Parameters:
channel the channel whose current range will be used to perform the conversion.
counts the count value to convert to volts.
Returns:
A voltage value calculated using the current D/A range. The voltage value returned is constrained to the current minimum-maximum voltage range of the D/A. (see setRange( int channel, int range )).
Exceptions:
IllegalArgumentException 

IntArray AIOUSB::DA12_AnalogOutputSubsystem::getRange ( int  startChannel,
int  numChannels 
) const

Gets the current voltage range of multiple D/A channels.

Parameters:
startChannel the first channel for which to obtain the current range.
numChannels the number of channels for which to obtain the current range.
Returns:
Array containing the current range for each of the specified channels.
See also:
setRange( int startChannel, const IntArray &range )
Exceptions:
IllegalArgumentException 

int AIOUSB::DA12_AnalogOutputSubsystem::getRange ( int  channel  )  const

Gets the current voltage range of a D/A channel.

Parameters:
channel the channel for which to obtain the current range.
Returns:
Current voltage range.
See also:
setRange( int channel, int range )
Exceptions:
IllegalArgumentException 

std::string AIOUSB::DA12_AnalogOutputSubsystem::getRangeText ( int  range  )  [static]

Gets the textual string for the specified range.

Parameters:
range the range for which to obtain the textual string.
Returns:
The textual string for the specified range.
See also:
setRange( int range )
Exceptions:
IllegalArgumentException 

DA12_AnalogOutputSubsystem & AIOUSB::DA12_AnalogOutputSubsystem::setRange ( int  range  ) 

Sets the current voltage range of all D/A channels to the same value.

Parameters:
range the voltage range to select.
Returns:
This subsystem, useful for chaining together multiple operations.
See also:
setRange( int channel, int range )

DA12_AnalogOutputSubsystem & AIOUSB::DA12_AnalogOutputSubsystem::setRange ( int  startChannel,
const IntArray range 
)

Sets the current voltage range of multiple D/A channels.

Parameters:
startChannel the first channel for which to set the range.
range an array of voltage ranges to select, one per channel. The length of this array implicitly specifies the number of channels to configure.
Returns:
This subsystem, useful for chaining together multiple operations.
See also:
setRange( int channel, int range )
Exceptions:
IllegalArgumentException 

DA12_AnalogOutputSubsystem & AIOUSB::DA12_AnalogOutputSubsystem::setRange ( int  channel,
int  range 
)

Sets the voltage range of a D/A channel. The ranges in this device are selected by means of hardware jumpers, so these range settings here do not affect the hardware. However, they are used to perform conversions between volts and counts. Moreover, the range setting is per D/A channel, so care must be taken when setting the ranges to ensure that the software setting matches the hardware jumper configuration, otherwise the voltage-count conversions will be incorrect.

Parameters:
channel the channel for which to set the range.
range the voltage range to select. May be one of:
DA12_AnalogOutputSubsystem::RANGE_0_2_5V
DA12_AnalogOutputSubsystem::RANGE_2_5V
DA12_AnalogOutputSubsystem::RANGE_0_5V
DA12_AnalogOutputSubsystem::RANGE_5V
DA12_AnalogOutputSubsystem::RANGE_0_10V
DA12_AnalogOutputSubsystem::RANGE_10V
Returns:
This subsystem, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 

unsigned short AIOUSB::DA12_AnalogOutputSubsystem::voltsToCounts ( int  channel,
double  volts 
) const

Converts a single voltage value to D/A counts, based on the current range setting.

Parameters:
channel the channel whose current range will be used to perform the conversion.
volts the voltage value to convert to counts.
Returns:
A count value calculated using the current D/A range. The count value returned is constrained to the current minimum-maximum count range of the D/A. (see setRange( int channel, int range )).
Exceptions:
IllegalArgumentException 

DA12_AnalogOutputSubsystem & AIOUSB::DA12_AnalogOutputSubsystem::writeVolts ( const OutputVoltagePointArray points  ) 

Writes a block of voltage values to one or more D/A channels.

Parameters:
points an array of OutputVoltagePoint points representing channel-voltage pairs.
Returns:
This subsystem, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 

DA12_AnalogOutputSubsystem & AIOUSB::DA12_AnalogOutputSubsystem::writeVolts ( int  channel,
double  volts 
)

Writes a voltage value to a D/A channel.

Parameters:
channel the channel to write to.
volts the voltage value to output.
Returns:
This subsystem, useful for chaining together multiple operations.


Friends And Related Function Documentation

friend class USB_DA12_8A_Family [friend]

friend class USB_DA12_8E_Family [friend]


Member Data Documentation

Maximum number of counts D/A can output.

Minimum number of counts D/A can output.

Unipolar, 0-10 volt range (see setRange( int channel, int range )).

Unipolar, 0-2.5 volt range (see setRange( int channel, int range )).

Unipolar, 0-5 volt range (see setRange( int channel, int range )).

Bipolar, -10 to +10 volt range (see setRange( int channel, int range )).

Bipolar, -2.5 to +2.5 volt range (see setRange( int channel, int range )).

Bipolar, -5 to +5 volt range (see setRange( int channel, int range )).

const char AIOUSB::DA12_AnalogOutputSubsystem::RANGE_TEXT [static, protected]

Initial value:

 {
    
      "0-2.5V"
    , "+/-2.5V"
    , "0-5V"
    , "+/-5V"
    , "0-10V"
    , "+/-10V"
}


doxygen