|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.LabJack.LabJackWrapper
This is a helper class providing a simpler, alternate interface for the LabJack analog/digital USB I/O box.
Use the LabJack JNI class for access to all LabJack features.
| Field Summary | |
static int |
AO0
Constant for specifying D/A output channel |
static int |
AO1
Constant for specifying D/A output channel |
protected int |
demo
|
protected int[] |
idnum
|
| Constructor Summary | |
LabJackWrapper(int idnum)
Class constructor. |
|
LabJackWrapper(int idnum,
int demo)
|
|
| Method Summary | |
void |
addSPI(SPI device)
Used to add an SPI device to the list of SPI devices attached to the LabJack. |
float |
analogInDI(int channel,
int gain)
Reads differental analog input value. |
float |
analogInSE(int channel)
Reads single-ended analog input value. |
void |
analogOut(int channel,
float voltage)
Outputs analog value. |
void |
configSPI(int spiMode)
Used to specify basic SPI configuration, using default values for most items. |
void |
configSPI(int spiMode,
int spiMsDelay,
int spiHusDelay,
int spiControlCS,
int spiCsLine,
int spiCsState,
int spiConfigD)
Used to fully specify SPI configuration. |
double |
counterRead(int reset)
Reads digital counter. |
double |
counterRead(int reset,
double[] ms)
Reads digital counter. |
boolean |
digitalIn(int channel)
Reads value on 'digital' pin (DB-25 connector). |
void |
digitalOut(int channel,
int state)
Sets value on 'digital' pin (DB-25). |
boolean |
ioIn(int channel)
Reads value on IO pin. |
void |
ioOut(int channel,
int state)
Sets value on IO pin. |
void |
updateSPI()
This method performs SPI communication, transfering data in from and/or out to SPI peripherals attached to the LabJack. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int AO0
public static final int AO1
protected int[] idnum
protected int demo
| Constructor Detail |
public LabJackWrapper(int idnum)
idnum - Local identifier of LabJack to communicate with.
public LabJackWrapper(int idnum,
int demo)
| Method Detail |
public float analogInSE(int channel)
throws LabJackException
channel - Which channel to read from (0-7).
LabJackException
public float analogInDI(int channel,
int gain)
throws LabJackException
channel - Which channel to read from (0-3).gain - Programmable gain value (G_1 - G_20)
LabJackException
public void analogOut(int channel,
float voltage)
throws LabJackException
channel - Which channel to output to (0/1)
LabJackException
public double counterRead(int reset,
double[] ms)
throws LabJackException
reset - Reset counter after reading if > 0.ms - Receives time (Windows ms timer) counter was actually read.
LabJackException
public double counterRead(int reset)
throws LabJackException
reset - Reset counter after reading if > 0.
LabJackException
public boolean ioIn(int channel)
throws LabJackException
channel - Which input to read (0-3).
LabJackException
public void ioOut(int channel,
int state)
throws LabJackException
channel - Which output to set (0-3).state - Value to set output to (0/1).
LabJackException
public boolean digitalIn(int channel)
throws LabJackException
channel - Which input to read (0-15).
LabJackException
public void digitalOut(int channel,
int state)
throws LabJackException
channel - Which output to set (0-15).state - Value to set output to (0/1).
LabJackExceptionpublic void addSPI(SPI device)
SPI devices are added to the list starting with the first device in the SPI chain, working towards the last device in the chain. If you sub-divide a device into multiple groups of bits, add the groups starting with the LSB's working towards the MSB's.
All devices must be added before invoking updateSPI()
device - A single SPI device.public void configSPI(int spiMode)
Refer to the Synch() API method for information on configuring SPI.
spiMode - Specifies SPI mode (0: Mode A, 1: Mode B, etc.)
public void configSPI(int spiMode,
int spiMsDelay,
int spiHusDelay,
int spiControlCS,
int spiCsLine,
int spiCsState,
int spiConfigD)
Refer to the Synch() API method for information on configuring SPI.
spiMode - Specify SPI mode as: 0=A,1=B,2=C,3=D (0-3).spiMsDelay - If >0, a 1 ms delay is added between each bit.spiHusDelay - If >0, a hundred us delay is added between each bit.spiControlCS - If >0, D0-D7 is automatically controlled as CS. The state and direction of CS is only tested if control is enabled.spiCsLine - D line to use as CS if enabled (0-7).spiCsState - Active state for CS line. This would be 0 for the normal !CS, or >0 for the less common CS.spiConfigD - If >0, state and tris are configured for D13, D14, D15, and !CS.
public void updateSPI()
throws LabJackException
The SPI hardware configuration must be specified using configSPI() and SPI devices added using addSPI() before using this method.
LabJackException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||