com.acces.aiousb
Class AnalogOutputSubsystem

java.lang.Object
  extended by com.acces.aiousb.AnalogOutputSubsystem

public class AnalogOutputSubsystem
extends java.lang.Object

Class 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_AO16_Family.dac()).


Field Summary
static int DAC_RANGE_0_10V
          Unipolar, 0-10 volt range.
static int DAC_RANGE_0_5V
          Unipolar, 0-5 volt range (see setRange()).
static int DAC_RANGE_10V
          Bipolar, -10 to +10 volt range.
static int DAC_RANGE_5V
          Bipolar, -5 to +5 volt range.
static int MAX_COUNTS
          Maximum number of counts D/A can output.
 
Constructor Summary
AnalogOutputSubsystem(USBDevice parent)
          Constructor for analog output subsystem.
 
Method Summary
 double countsToVolts(char counts)
          Converts a single D/A count value to volts, based on the current range setting.
 double[] countsToVolts(char[] counts)
          Converts an array of D/A count values to an array of voltage values, based on the current range setting.
 int getNumChannels()
          Gets the number of analog output channels.
 int getRange()
          Gets the current voltage range of the D/A outputs.
 java.io.PrintStream print(java.io.PrintStream stream)
          Prints the properties of this subsystem.
 AnalogOutputSubsystem setRange(int range)
          Sets the voltage range of the D/A outputs.
 char voltsToCounts(double volts)
          Converts a single voltage value to D/A counts, based on the current range setting.
 char[] voltsToCounts(double[] volts)
          Converts an array of voltage values to an array of D/A count values, based on the current range setting.
 AnalogOutputSubsystem write(char[] points)
          Writes a block of count values to one or more D/A channels.
 AnalogOutputSubsystem write(int channel, char counts)
          Writes a count value to a D/A channel.
 AnalogOutputSubsystem writeVolts(int channel, double volts)
          Writes a voltage value to a D/A channel.
 AnalogOutputSubsystem writeVolts(OutputVoltagePoint[] points)
          Writes a block of voltage values to one or more D/A channels.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DAC_RANGE_0_5V

public static final int DAC_RANGE_0_5V
Unipolar, 0-5 volt range (see setRange()).

See Also:
Constant Field Values

DAC_RANGE_5V

public static final int DAC_RANGE_5V
Bipolar, -5 to +5 volt range.

See Also:
Constant Field Values

DAC_RANGE_0_10V

public static final int DAC_RANGE_0_10V
Unipolar, 0-10 volt range.

See Also:
Constant Field Values

DAC_RANGE_10V

public static final int DAC_RANGE_10V
Bipolar, -10 to +10 volt range.

See Also:
Constant Field Values

MAX_COUNTS

public static final int MAX_COUNTS
Maximum number of counts D/A can output.

See Also:
Constant Field Values
Constructor Detail

AnalogOutputSubsystem

public AnalogOutputSubsystem(USBDevice parent)
Constructor for analog output subsystem.

Parameters:
parent - the parent USB device object that this subsystem is a part of.
Method Detail

print

public java.io.PrintStream print(java.io.PrintStream stream)
Prints the properties of this subsystem. Mainly useful for diagnostic purposes.

Parameters:
stream - the print stream where properties will be printed.
Returns:
The print stream.

getNumChannels

public int getNumChannels()
Gets the number of analog output channels.

Returns:
Number of channels, numbered 0 to n-1.

getRange

public int getRange()
Gets the current voltage range of the D/A outputs.

Returns:
Current voltage range.
See Also:
setRange()

setRange

public AnalogOutputSubsystem setRange(int range)
Sets the voltage range of the D/A outputs.

Parameters:
range - the voltage range to select. May be one of:
DAC_RANGE_0_5V
DAC_RANGE_5V
DAC_RANGE_0_10V
DAC_RANGE_10V
Returns:
This subsystem, useful for chaining together multiple operations.
Throws:
java.lang.IllegalArgumentException
OperationFailedException

write

public AnalogOutputSubsystem write(int channel,
                                   char counts)
Writes a count value to a D/A channel.

Parameters:
channel - the channel to write to.
counts - the D/A count value to output. The number of bits of resolution for the D/A outputs varies from model to model, however it's usually 12 or 16 bits. Moreover, some of the 12-bit models actually accept a 16-bit value and simply truncate the least significant 4 bits. Consult the manual for the specific device to determine the range of D/A values the device will accept. In general, 12-bit devices accept a count range of 0-0xfff, and 16-bit devices accept a count range of 0-0xffff.
Returns:
This subsystem, useful for chaining together multiple operations.
Throws:
java.lang.IllegalArgumentException
OperationFailedException

write

public AnalogOutputSubsystem write(char[] points)
Writes a block of count values to one or more D/A channels.

Parameters:
points - an array of 16-bit integers representing channel-count pairs. The first integer of each pair is the D/A channel number and the second integer is the D/A count value to output to the specified channel. Refer to write() for an explanation of the channel addressing and count values.
Returns:
This subsystem, useful for chaining together multiple operations.
Throws:
java.lang.IllegalArgumentException
OperationFailedException

writeVolts

public 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.

writeVolts

public AnalogOutputSubsystem writeVolts(OutputVoltagePoint[] 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.
Throws:
java.lang.IllegalArgumentException

countsToVolts

public double countsToVolts(char counts)
Converts a single 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 D/A range. (see setRange()).

countsToVolts

public double[] countsToVolts(char[] counts)
Converts an array of D/A count values to an array of voltage values, based on the current range setting.

Parameters:
counts - the array of count values to convert to volts.
Returns:
An array of voltage values calculated using the current D/A range. (see setRange()).
Throws:
java.lang.IllegalArgumentException

voltsToCounts

public char voltsToCounts(double volts)
Converts a single voltage value to 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 minimum-maximum count range of the D/A. (see setRange()).

voltsToCounts

public char[] voltsToCounts(double[] volts)
Converts an array of voltage values to an array of D/A count values, based on the current range setting.

Parameters:
volts - the array of voltage values to convert to counts.
Returns:
An array of count values calculated using the current D/A range. Each count value returned is constrained to the minimum-maximum count range of the D/A. (see setRange()).
Throws:
java.lang.IllegalArgumentException