|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.acces.aiousb.CounterSubsystem
public class CounterSubsystem
Class CounterSubsystem represents the counter/timer subsystem of a device. One accesses
this counter/timer subsystem through its parent object, typically through a method such as
ctr() (see USB_AI16_Family.ctr()
).
Method Summary | |
---|---|
Counter |
getCounter(int counter)
Gets a reference to an individual counter. |
int |
getNumCounterBlocks()
Gets the number of counter blocks. |
int |
getNumCounters()
Gets the number of individual counters, indexed from 0 to n-1. |
USBDevice |
getParent()
Gets the parent device that this subsystem is part of. |
java.io.PrintStream |
print(java.io.PrintStream stream)
Prints the properties of this subsystem. |
char[] |
readCounts(boolean oldData)
Reads the current count values of all the counters, optionally including an "old data" indication. |
CounterSubsystem |
selectGate(int counter)
Selects the counter to use as a gate in frequency measurement on other counters. |
double |
startClock(int counterBlock,
double clockHz)
Selects an output frequency for a counter block and starts the counters. |
CounterSubsystem |
stopClock(int counterBlock)
Halts the counter started by startClock() |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public java.io.PrintStream print(java.io.PrintStream stream)
stream
- the print stream where properties will be printed.
public int getNumCounterBlocks()
public int getNumCounters()
public Counter getCounter(int counter)
counter
- the counter for which to obtain a reference (0 to n-1).
java.lang.IllegalArgumentException
public char[] readCounts(boolean oldData)
oldData
- true includes the "old data" indication in the returned data; false returns just the count values.
OperationFailedException
public CounterSubsystem selectGate(int counter)
counter
- the counter to select as a gate (0 to n-1).
java.lang.IllegalArgumentException
OperationFailedException
public double startClock(int counterBlock, double clockHz)
selectGate()
and readCounts( true )
are used in measuring frequency. To measure frequency one must count pulses for a known duration. In simplest terms,
the number of pulses that occur for 1 second translates directly to Hertz. In the USB-CTR-15 and other supported devices,
you can create a known duration by configuring one counter to act as a "gating" signal for any collection of other counters.
The other "measurement" counters will only count during the "high" side of the gate signal, which we can control.selectGate()
to tell the board which counter is generating that gatereadCounts( true )
periodically to read the latched count values from
all the "measurement" counters.selectGate()
.readCounts( true )
call, it
can be translated into actual Hz by dividing the count value returned by the high-side-duration of the gating signal, in seconds.
For example, if your gate is configured for 10Hz, the high-side lasts 0.05 seconds. If you read 1324 counts via the
readCounts( true )
call, the frequency would be "1324 / 0.05", or 26.48 KHz.
counterBlock
- the counter block to use to generate the frequency.clockHz
- the desired output frequency (in Hertz).
java.lang.IllegalArgumentException
OperationFailedException
public CounterSubsystem stopClock(int counterBlock)
startClock()
counterBlock
- the counter block to halt generating a frequency.
public USBDevice getParent()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |