|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer | +--com.dalsemi.onewire.container.OneWireContainer20
iButton container for iButton family type 20 (hex). The DS2450 is a Quad A\D converter.
WARNING! When converting Analog voltages to digital, the user of the device must gaurantee that the voltage seen by the channel of the quad a\d does not exceed the selected input range of the device. If this happens, the device will default to reading 0 volts. The is NO way to know if the device is reading a higher than specified voltage or NO voltage.
Typical Setup:
Typical Read voltage:
Field Summary | |
static int |
ALARM_OFFSET
Offset of ALARMS in array returned from read state |
static int |
BITMAP_OFFSET
Offset of BITMAP in array returned from read state |
static int |
CHANNELA
Channel A number |
static int |
CHANNELB
Channel B number |
static int |
CHANNELC
Channel C number |
static int |
CHANNELD
Channel D number |
static int |
EXPOWER_OFFSET
Offset of external power offset in array returned from read state |
static int |
NO_PRESET
No preset value |
static int |
NUM_CHANNELS
Number of channels |
static int |
PRESET_TO_ONES
Preset value to ones |
static int |
PRESET_TO_ZEROS
Preset value to zeros |
Fields inherited from interface com.dalsemi.onewire.container.ADContainer |
ALARM_HIGH, ALARM_LOW |
Constructor Summary | |
OneWireContainer20()
Default constructor |
|
OneWireContainer20(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer20(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer20(DSPortAdapter sourceAdapter,
java.lang.String newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
Method Summary | |
boolean |
canADMultiChannelRead()
Query to see if this A/D supports doing multiple voltage conversions at the same time. |
void |
doADConvert(boolean[] doConvert,
byte[] state)
This method is used to perform voltage conversion on all specified channels. |
void |
doADConvert(boolean[] doConvert,
int[] preset,
byte[] state)
This method is used to perform voltage conversion on all specified channels. |
void |
doADConvert(int channel,
byte[] state)
This method is used to perform voltage conversion on all specified channels. |
void |
doADConvert(int channel,
int preset,
byte[] state)
This method is used to perform voltage conversion on all specified channels. |
double |
getADAlarm(int channel,
int alarmType,
byte[] state)
This method is used to extract the alarm voltage value of the specified channel from the provided state buffer. |
boolean |
getADAlarmEnable(int channel,
int alarmType,
byte[] state)
This method is used to extract the alarm enable value of the specified channel from the provided state buffer. |
double |
getADRange(int channel,
byte[] state)
This method is used to extract the input voltage range of the specified channel from the provided state buffer. |
double[] |
getADRanges(int channel)
Query to get an array of available ranges for the specified A/D channel. |
double |
getADResolution(int channel,
byte[] state)
This method is used to extract the conversion resolution of the specified channel from the provided state buffer expressed in volts. |
double[] |
getADResolutions(int channel,
double range)
Query to get an array of available resolutions based on the specified range on the specified A/D channel. |
double[] |
getADVoltage(byte[] state)
This method is used to read the voltage values. |
double |
getADVoltage(int channel,
byte[] state)
This method is used to read a channels voltage value. |
java.lang.String |
getAlternateNames()
getAlternateNames returns any other possible name for this iButton. |
java.lang.String |
getDescription()
getDescription returns a String that contains a brief description of the functionalitly of this iButton. |
boolean |
getDevicePOR(byte[] state)
This method is used to detect if the device has seen a Power-On-Reset (POR). |
int |
getMaxSpeed()
Returns the maximum speed this iButton can communicate at. |
java.util.Enumeration |
getMemoryBanks()
Return an enumeration of memory banks. |
java.lang.String |
getName()
getName returns the name of the iButton that this class contains. |
int |
getNumberADChannels()
Query to get the number of channels supported by this A/D. |
boolean |
getOutputState(int channel,
byte[] state)
This method is used to detect if the output is enabled for the specified channel from the provided register buffer. |
boolean |
hasADAlarmed(int channel,
int alarmType,
byte[] state)
This method is used to check the alarm event value of the specified channel from the provided state buffer. |
boolean |
hasADAlarms()
Query to see if this A/D measuring device has high/low alarms. |
static double |
interpretVoltage(long rawVoltage,
double range)
This method is used to convert a raw voltage long value for the DS2450 into a valid voltage. |
boolean |
isOutputEnabled(int channel,
byte[] state)
This method is used to detect if the output is enabled for the specified channel from the provided register buffer. |
boolean |
isPowerExternal(byte[] state)
This method is used to extract the state of the external power indicator from the provided register buffer. |
byte[] |
readDevice()
This method retrieves the entire A/D control/status and alarm pages. |
void |
setADAlarm(int channel,
int alarmType,
double alarm,
byte[] state)
This method is used to set the alarm voltage value of the specified channel in the provided state buffer. |
void |
setADAlarmEnable(int channel,
int alarmType,
boolean alarmEnable,
byte[] state)
This method is used to set the alarm enable value of the specified channel in the provided state buffer. |
void |
setADRange(int channel,
double range,
byte[] state)
This method is used to set the input range for the specified channel in the provided state buffer. |
void |
setADResolution(int channel,
double resolution,
byte[] state)
This method is used to set the conversion resolution value for the specified channel in the provided state buffer. |
void |
setOutput(int channel,
boolean outputEnable,
boolean outputState,
byte[] state)
This method is used to set the output enable and state for the specified channel in the provided register buffer. |
void |
setPower(boolean external,
byte[] state)
This method is used to set or clear the external power flag in the provided register buffer. |
static int |
voltageToInt(double voltage,
double range)
This method is used to convert a voltage double value to the DS2450 specific int value. |
void |
writeDevice(byte[] state)
This method write the bytes in the provided A/D register pages that have been changed by the 'set' methods. |
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, getAdapter, getAddress, getAddressAsLong, getAddressAsString, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BITMAP_OFFSET
public static final int ALARM_OFFSET
public static final int EXPOWER_OFFSET
public static final int CHANNELA
public static final int CHANNELB
public static final int CHANNELC
public static final int CHANNELD
public static final int NO_PRESET
public static final int PRESET_TO_ZEROS
public static final int PRESET_TO_ONES
public static final int NUM_CHANNELS
Constructor Detail |
public OneWireContainer20()
public OneWireContainer20(DSPortAdapter sourceAdapter, byte[] newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer20(DSPortAdapter sourceAdapter, long newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer20(DSPortAdapter sourceAdapter, java.lang.String newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceMethod Detail |
public java.lang.String getName()
getName
in class OneWireContainer
String
representation of the iButtons namepublic java.lang.String getAlternateNames()
getAlternateNames
in class OneWireContainer
String
representation of the iButtons other namespublic java.lang.String getDescription()
getDescription
in class OneWireContainer
String
containing a description of the functionalitlypublic int getMaxSpeed()
getMaxSpeed
in class OneWireContainer
public java.util.Enumeration getMemoryBanks()
getMemoryBanks
in class OneWireContainer
com.dalsemi.onewire.container.OneWireContainer
public int getNumberADChannels()
getNumberADChannels
in interface ADContainer
public boolean hasADAlarms()
hasADAlarms
in interface ADContainer
public double[] getADRanges(int channel)
getADRanges
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].public double[] getADResolutions(int channel, double range)
getADResolutions
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].range
- public boolean canADMultiChannelRead()
canADMultiChannelRead
in interface ADContainer
public byte[] readDevice() throws OneWireIOException, OneWireException
readDevice
in interface OneWireSensor
byte[]<\code> register page contents verified
with onboard CRC- Throws:
OneWireIOException
- OneWireException
-
public void writeDevice(byte[] state) throws OneWireIOException, OneWireException
writeDevice
in interface OneWireSensor
state
- - byte array of register pagesOneWireIOException
- OneWireException
- public double[] getADVoltage(byte[] state) throws OneWireIOException, OneWireException
getADVoltage
in interface ADContainer
state
- - byte array of the current state of the
device returned from 'readDevice()'.OneWireIOException
- OneWireException
- public double getADVoltage(int channel, byte[] state) throws OneWireIOException, OneWireException
getADVoltage
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].state
- - byte array of the current state of the
device returned from 'readDevice()'.OneWireIOException
- OneWireException
- public void doADConvert(int channel, byte[] state) throws OneWireIOException, OneWireException
doADConvert
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].state
- - byte array of the current state of the
device returned from 'readDevice()'.OneWireIOException
- OneWireException
- public void doADConvert(boolean[] doConvert, byte[] state) throws OneWireIOException, OneWireException
doADConvert
in interface ADContainer
doConvert
- - boolean array representing which channels
to perform conversion on.state
- - byte array of the current state of the
device returned from 'readDevice()'.OneWireIOException
- OneWireException
- public void doADConvert(int channel, int preset, byte[] state) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
channel
- - integer 0,1,2,3 representing the channels A,B,C,D.preset
- - int representing the preset value:
NO_PRESET (0), PRESET_TO_ZEROS (1), and PRESET_TO_ONES (2).state
- - byte array of the current state of the
device returned from 'readDevice()'.OneWireIOException
- OneWireException
- java.lang.IllegalArgumentException
- public void doADConvert(boolean[] doConvert, int[] preset, byte[] state) throws OneWireIOException, OneWireException
doConvert
- - boolean array representing which channels
to perform conversion on.preset
- - int array representing the preset values:
NO_PRESET (0), PRESET_TO_ZEROS (1), and PRESET_TO_ONES (2).state
- - byte array of the current state of the
device returned from 'readDevice()'.OneWireIOException
- OneWireException
- public double getADAlarm(int channel, int alarmType, byte[] state)
getADAlarm
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].alarmType
- - int, representing the desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)state
- - byte array of the current state of the
device returned from 'readDevice()'.public boolean getADAlarmEnable(int channel, int alarmType, byte[] state)
getADAlarmEnable
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].alarmType
- - int, representing the desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)state
- - byte array of the current state of the state
returned from 'readDevice()'.public boolean hasADAlarmed(int channel, int alarmType, byte[] state)
hasADAlarmed
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].alarmType
- - int, representing the desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)state
- - byte array of the current state of the state
returned from 'readDevice()'.public double getADResolution(int channel, byte[] state)
getADResolution
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].state
- - byte array of the current state of the state
returned from 'readDevice()'.public double getADRange(int channel, byte[] state)
getADRange
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].state
- - byte array of the current state of the state
returned from 'readDevice()'.public boolean isOutputEnabled(int channel, byte[] state) throws java.lang.IllegalArgumentException
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].state
- - byte array of the current state of the device
returned from 'readDevice()'.java.lang.IllegalArgumentException
- public boolean getOutputState(int channel, byte[] state) throws java.lang.IllegalArgumentException
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].state
- - byte array of the current state of the device
returned from 'readDevice()'.java.lang.IllegalArgumentException
- public boolean getDevicePOR(byte[] state)
state
- - byte array of the current state of the device
returned from 'readDevice()'.public boolean isPowerExternal(byte[] state)
state
- - byte array of the current state of the
device returned from 'readDevice()'.public void setADAlarm(int channel, int alarmType, double alarm, byte[] state)
setADAlarm
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].alarmType
- - int, representing the desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)alarm
- - double, alarm value (will be reduced to 8 bit resolution).state
- - byte array of the current state of the
device returned from 'readDevice()'.public void setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state)
setADAlarmEnable
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].alarmType
- - int, representing the desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)alarmEnable
- - boolean, alarm enable valuestate
- - byte array of the current state of the
device returned from 'readDevice()'.public void setADResolution(int channel, double resolution, byte[] state)
setADResolution
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].resolution
- - double, resolution to use in voltsstate
- - byte array of the current state of the
device returned from 'readDevice()'.public void setADRange(int channel, double range, byte[] state)
setADRange
in interface ADContainer
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].range
- - double, representing the max volt range, use
'getRanges()' method to get available rangesstate
- - byte array of the current state of the
device returned from 'readDevice()'.public void setOutput(int channel, boolean outputEnable, boolean outputState, byte[] state)
channel
- - integer specifying channel in the range
[0 to (getNumberChannels() - 1)].outputEnable
- - boolean, true if output is enabledoutputState
- - boolean, false if output is conducting to
ground and true not conducting. This parameter is not
used if outputEnable is false.state
- - byte array of the current state of the
device returned from 'readDevice()'.public void setPower(boolean external, byte[] state)
external
- - boolean, true if setting external power is usedstate
- - byte array of the current state of the
device returned from 'readDevice()'.public static double interpretVoltage(long rawVoltage, double range)
rawVoltage
- - long of the raw voltagerange
- - max voltagepublic static int voltageToInt(double voltage, double range)
rawVoltage
- - long of the raw voltagevoltage
- range
- - max voltage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |