AIOUSB::Counter Class Reference

#include <Counter.hpp>

Collaboration diagram for AIOUSB::Counter:

Collaboration graph
[legend]

List of all members.

Public Member Functions

int getDeviceIndex () const
CountersetMode (int mode)
CountersetCount (unsigned short count)
CountersetModeAndCount (int mode, unsigned short count)
unsigned short readCount ()
UShortArray readCountAndStatus ()
unsigned short readCountAndSetModeAndCount (int mode, unsigned short count)

Static Public Attributes

static const int MODE_TERMINAL_COUNT = 0
static const int MODE_ONE_SHOT = 1
static const int MODE_RATE_GENERATOR = 2
static const int MODE_SQUARE_WAVE = 3
static const int MODE_SW_TRIGGERED = 4
static const int MODE_HW_TRIGGERED = 5

Protected Member Functions

 Counter (CounterSubsystem *parent, int counterIndex)

Protected Attributes

CounterSubsystemparent
int counterIndex

Friends

class CounterSubsystem


Detailed Description

Class Counter represents a single counter/timer. One accesses a counter through its CounterSubsystem parent object (see CounterSubsystem::getCounter( int counter )).

Constructor & Destructor Documentation

AIOUSB::Counter::Counter ( CounterSubsystem parent,
int  counterIndex 
) [protected]


Member Function Documentation

int AIOUSB::Counter::getDeviceIndex (  )  const

Gets the index of the parent device on the USB bus. Used internally in calls to the underlying API.

Returns:
The index of the parent device on the USB bus.

unsigned short AIOUSB::Counter::readCount (  ) 

Reads a counter's current count value.

Returns:
The current count value (0-65,535).
Exceptions:
OperationFailedException 

unsigned short AIOUSB::Counter::readCountAndSetModeAndCount ( int  mode,
unsigned short  count 
)

Reads a counter's current count value, then sets a new mode and loads a new count value into the counter.

Parameters:
mode the counter mode (see setMode( int mode )).
count the count value (0-65,535) to load into the counter.
Returns:
The 16-bit count value (0-65,535) prior to setting the new mode and count.
Exceptions:
IllegalArgumentException 
OperationFailedException 

UShortArray AIOUSB::Counter::readCountAndStatus (  ) 

Reads a counter's current count value and status.

Returns:
An array of 2 16-bit integers:
char[ 0 ] contains the current count value (0-65,535)
char[ 1 ] contains the current counter status (0-255)
Exceptions:
OperationFailedException 

Counter & AIOUSB::Counter::setCount ( unsigned short  count  ) 

Loads a count value into the counter.

Parameters:
count the count value (0-65,535) to load into the counter.
Returns:
This counter, useful for chaining together multiple operations.
Exceptions:
OperationFailedException 

Counter & AIOUSB::Counter::setMode ( int  mode  ) 

Sets the counter's mode.

Parameters:
mode the counter mode. May be one of:
Counter::MODE_TERMINAL_COUNT
Counter::MODE_ONE_SHOT
Counter::MODE_RATE_GENERATOR
Counter::MODE_SQUARE_WAVE
Counter::MODE_SW_TRIGGERED
Counter::MODE_HW_TRIGGERED
Returns:
This counter, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 
OperationFailedException 

Counter & AIOUSB::Counter::setModeAndCount ( int  mode,
unsigned short  count 
)

Sets a counter mode and loads a count value into the counter.

Parameters:
mode the counter mode (see setMode( int mode )).
count the count value (0-65,535) to load into the counter.
Returns:
This counter, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 
OperationFailedException 


Friends And Related Function Documentation

friend class CounterSubsystem [friend]


Member Data Documentation

const int AIOUSB::Counter::MODE_HW_TRIGGERED = 5 [static]

Mode 5: hardware triggered strobe (retriggerable) (see setMode( int mode )).

const int AIOUSB::Counter::MODE_ONE_SHOT = 1 [static]

Mode 1: hardware retriggerable one-shot (see setMode( int mode )).

const int AIOUSB::Counter::MODE_RATE_GENERATOR = 2 [static]

Mode 2: rate generator (see setMode( int mode )).

const int AIOUSB::Counter::MODE_SQUARE_WAVE = 3 [static]

Mode 3: square wave mode (see setMode( int mode )).

const int AIOUSB::Counter::MODE_SW_TRIGGERED = 4 [static]

Mode 4: software triggered mode (see setMode( int mode )).

const int AIOUSB::Counter::MODE_TERMINAL_COUNT = 0 [static]

Mode 0: interrupt on terminal count (see setMode( int mode )).


doxygen