AIOUSB::AnalogIORange Class Reference

#include <AnalogIORange.hpp>

Inheritance diagram for AIOUSB::AnalogIORange:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 AnalogIORange ()
 AnalogIORange (int minCounts, int maxCounts)
virtual ~AnalogIORange ()
int getRange () const
virtual AnalogIORangesetRange (int range)
AnalogIORangesetCountRange (int minCounts, int maxCounts)
AnalogIORangesetVoltRange (double minVolts, double maxVolts)
double countsToVolts (int counts) const
int voltsToCounts (double volts) const

Protected Attributes

int range
int minCounts
int maxCounts
int rangeCounts
double minVolts
double maxVolts
double rangeVolts


Detailed Description

Class AnalogIORange helps manage analog I/O range settings and provides voltage-count conversion utilities. A single instance can be used with devices that support just one range, or multiple instances can be used with devices that support multiple ranges, such as a separate range per analog I/O channel. This class also supports changing the range properties. Some devices, for instance, permit the range to be changed at run-time. The class that owns this instance can change the range by calling one or more of the methods of this class. Or, for devices that do not support changing the range, the properties can be set up once and left alone. Or, some properties can be changed and others left alone. For example, devices that permit changing the voltage range usually use a fixed count range.

Constructor & Destructor Documentation

AIOUSB::AnalogIORange::AnalogIORange (  ) 

Constructor which uses the default properties.

AIOUSB::AnalogIORange::AnalogIORange ( int  minCounts,
int  maxCounts 
)

Constructor which sets the count range. The count range is usually constant, so setting it one time in the constructor is convenient.

Parameters:
minCounts minimum counts for current range.
maxCounts maximum counts for current range.

AIOUSB::AnalogIORange::~AnalogIORange (  )  [virtual]


Member Function Documentation

double AIOUSB::AnalogIORange::countsToVolts ( int  counts  )  const

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

Parameters:
counts the count value to convert to volts.
Returns:
A voltage value calculated using the current range. The voltage value returned is constrained to the current minimum-maximum voltage range.

int AIOUSB::AnalogIORange::getRange (  )  const [inline]

Gets the current range ID.

Returns:
Current range ID (defined by class that owns this instance).

AnalogIORange & AIOUSB::AnalogIORange::setCountRange ( int  minCounts,
int  maxCounts 
)

Sets the A/D or D/A count range.

Parameters:
minCounts minimum counts for current range.
maxCounts maximum counts for current range.
Returns:
This subsystem, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 

AnalogIORange & AIOUSB::AnalogIORange::setRange ( int  range  )  [virtual]

Sets the range ID.

Parameters:
range the new range ID (defined by class that owns this instance).
Returns:
This subsystem, useful for chaining together multiple operations.

Reimplemented in AIOUSB::AI16_InputRange, AIOUSB::AO16_OutputRange, and AIOUSB::DA12_OutputRange.

AnalogIORange & AIOUSB::AnalogIORange::setVoltRange ( double  minVolts,
double  maxVolts 
)

Sets the voltage range.

Parameters:
minVolts minimum volts for current range.
maxVolts maximum volts for current range.
Returns:
This subsystem, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 

int AIOUSB::AnalogIORange::voltsToCounts ( double  volts  )  const

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

Parameters:
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.


Member Data Documentation

double AIOUSB::AnalogIORange::maxVolts [protected]

double AIOUSB::AnalogIORange::minVolts [protected]


doxygen