Class OneWireContainer30
- java.lang.Object
-
- com.dalsemi.onewire.container.OneWireContainer
-
- com.dalsemi.onewire.container.OneWireContainer30
-
- All Implemented Interfaces:
ADContainer
,OneWireSensor
,TemperatureContainer
public class OneWireContainer30 extends OneWireContainer implements ADContainer, TemperatureContainer
1-Wire® container that encapsulates the functionality of the 1-Wire family type 30 (hex), Maxim Integrated Products part number: DS2760, High Precision Li-ion Battery Monitor.
Features
- Li-ion safety circuit
- Overvoltage protection
- Overcurrent/short circuit protection
- Undervoltage protection
- Two sense resistor configurations
- Internal 25 mOhm sense resistor
- External user-selectable sense resistor
- 12-bit bi-directional current measurement
- Current accumulation
- Voltage measurement
- Direct-to-digital temperature measurement
- 32 bytes of lockable EEPROM
- 16 bytes of general purpose SRAM
- Low power consumption
- Active current: 80 @htmlonly µA @endhtmlonly max
- Sleep current: 2 @htmlonly µA @endhtmlonly max
Data sheet
http://pdfserv.maxim-ic.com/arpdf/DS2760.pdf
-
-
Field Summary
Fields Modifier and Type Field Description static byte
CC_PIN_STATE_FLAG
PROTECTION REGISTER FLAG: Mirrors the !CC output pin.static byte
CHARGE_ENABLE_FLAG
PROTECTION REGISTER FLAG: Resetting this flag will disable charging regardless of cell or pack conditions.static byte
CHARGE_OVERCURRENT_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
the battery has experienced a charge-direction overcurrent condition.static byte
DC_PIN_STATE_FLAG
PROTECTION REGISTER FLAG: Mirrors the !DC output pin.static byte
DISCHARGE_ENABLE_FLAG
PROTECTION REGISTER FLAG: Resetting this flag will disable discharging.static byte
DISCHARGE_OVERCURRENT_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
the battery has experienced a discharge-direction overcurrent condition.static byte
EEPROM_BLOCK_0_LOCK_FLAG
EEPROM REGISTER FLAG: When this flag istrue
, Block 0 of the EEPROM (addresses 32-47) is read-only.static byte
EEPROM_BLOCK_1_LOCK_FLAG
EEPROM REGISTER FLAG: When this flag istrue
, Block 1 of the EEPROM (addresses 48-63) is read-only.static byte
EEPROM_COPY_FLAG
EEPROM REGISTER FLAG: This flag will betrue
if the Copy Data Command is in progress.static byte
EEPROM_LOCK_ENABLE_FLAG
EEPROM REGISTER FLAG: When this flag istrue
, the Lock Command is enabled.static byte
EEPROM_REGISTER
Address of the EEPROM Register.static byte
OVERVOLTAGE_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
, it indicates that the battery pack has experienced an overvoltage condition.static byte
PIO_PIN_SENSE_AND_CONTROL_FLAG
SPECIAL FEATURE REGISTER FLAG: Mirrors/sets the state of the PIO pin.static byte
PROTECTION_REGISTER
Address of the Protection Register.static byte
PS_PIN_STATE_FLAG
SPECIAL FEATURE REGISTER FLAG: Mirrors the state of the !PS pin.static byte
READ_NET_ADDRESS_OPCODE_FLAG
STATUS REGISTER FLAG: If set, the opcode for the Read Net Address command will be set to 33h.static byte
SLEEP_MODE_ENABLE_FLAG
STATUS REGISTER FLAG: Enables/disables the DS2760 to enter sleep mode when the DQ line goes low for greater than 2 seconds.static byte
SPECIAL_FEATURE_REGISTER
Address of the Special Feature Register (SFR).static byte
STATUS_REGISTER
Address of the Status Register.static byte
UNDERVOLTAGE_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
, the battery pack has experienced an undervoltage.-
Fields inherited from class com.dalsemi.onewire.container.OneWireContainer
adapter, address, speed, speedFallBackOK
-
Fields inherited from interface com.dalsemi.onewire.container.ADContainer
ALARM_HIGH, ALARM_LOW
-
Fields inherited from interface com.dalsemi.onewire.container.TemperatureContainer
ALARM_HIGH, ALARM_LOW
-
-
Constructor Summary
Constructors Constructor Description OneWireContainer30()
Default constructorOneWireContainer30(DSPortAdapter sourceAdapter, byte[] newAddress)
Creates a container with a provided adapter object and the address of this 1-Wire device.OneWireContainer30(DSPortAdapter sourceAdapter, long newAddress)
Creates a container with a provided adapter object and the address of this 1-Wire device.OneWireContainer30(DSPortAdapter sourceAdapter, java.lang.String newAddress)
Creates a container with a provided adapter object and the address of this 1-Wire device.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canADMultiChannelRead()
Queries to see if this A/D device supports doing multiple voltage conversions at the same time.void
clearConditions()
Clears the overvoltage, undervoltage, charge overcurrent, and discharge overcurrent flags.void
doADConvert(boolean[] doConvert, byte[] state)
Performs voltage conversion on all specified channels.void
doADConvert(int channel, byte[] state)
Performs voltage conversion on the specified channel.void
doTemperatureConvert(byte[] state)
Performs a temperature conversion.double
getADAlarm(int channel, int alarmType, byte[] state)
Extracts the alarm voltage value of the specified channel from the provided state buffer.boolean
getADAlarmEnable(int channel, int alarmType, byte[] state)
Extracts the alarm enable value of the specified channel from the provided state buffer.double
getADRange(int channel, byte[] state)
Extracts the A/D input voltage range of the specified channel from the provided state buffer.double[]
getADRanges(int channel)
Queries to get an array of available ranges for the specified A/D channel.double
getADResolution(int channel, byte[] state)
Extracts the A/D conversion resolution of the specified channel from the provided state buffer expressed in volts.double[]
getADResolutions(int channel, double range)
Queries to get an array of available resolutions based on the specified range on the specified A/D channel.double[]
getADVoltage(byte[] state)
Reads the voltage values.double
getADVoltage(int channel, byte[] state)
Reads a channel voltage value.java.lang.String
getAlternateNames()
Returns the alternate Maxim Integrated Products part number or name.double
getCurrent(byte[] state)
Gets the instantaneous current.java.lang.String
getDescription()
Returns a short description of the function of this 1-Wire device type.boolean
getFlag(int memAddr, byte flagToGet)
Checks the specified flag in the specified register.boolean
getLatchState()
Returns the latch state of the Programmable Input/Output pin on the DS2760.double
getMaxTemperature()
Queries to get the maximum temperature in degrees C.java.util.Enumeration<MemoryBank>
getMemoryBanks()
Get an enumeration of memory bank instances that implement one or more of the following interfaces:MemoryBank
,PagedMemoryBank
, andOTPMemoryBank
.double
getMinTemperature()
Queries to get the minimum temperature in degrees C.java.lang.String
getName()
Returns the Maxim Integrated Products part number of this 1-Wire device as a string.int
getNumberADChannels()
Queries to get the number of channels supported by this A/D device.double
getRemainingCapacity(byte[] state)
Calculates the remaining capacity in mAHours from the current Accumulator.double
getTemperature(byte[] state)
Extracts the temperature value in degrees C from the state data retrieved from thereadDevice()
method.double
getTemperatureAlarm(int alarmType, byte[] state)
Extracts the specified temperature alarm value in degrees C from the state data retrieved from thereadDevice()
method.double
getTemperatureAlarmResolution()
Queries to get the high/low temperature alarm resolution in degrees C.double
getTemperatureResolution(byte[] state)
Extracts the current temperature resolution in degrees C from the state data retrieved from thereadDevice()
method.double[]
getTemperatureResolutions()
Queries to get an array of available temperature resolutions in degrees C.boolean
hasADAlarmed(int channel, int alarmType, byte[] state)
Checks the A/D alarm event value of the specified channel from the provided state buffer.boolean
hasADAlarms()
Queries to see if this A/D measuring device has high/low alarms.boolean
hasSelectableTemperatureResolution()
Queries to see if this device has selectable temperature resolution.boolean
hasTemperatureAlarms()
Queries to see if this temperature measuring device has high/low trip alarms.void
lockBlock(int blockNumber)
Permanently write-protects one of the user blocks of EEPROM.byte
readByte(int memAddr)
Reads a register byte from the memory of the DS2760.void
readBytes(int memAddr, byte[] buffer, int start, int len)
Reads bytes from the DS2760.byte[]
readDevice()
Retrieves the 1-Wire device sensor state.byte[]
readEEPROMBlock(int blockNumber)
Reads a 16 byte data block from one of the user EEPROM blocks.void
setADAlarm(int channel, int alarmType, double alarm, byte[] state)
Sets the A/D alarm voltage value of the specified channel in the provided state buffer.void
setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state)
Sets the A/D alarm enable value of the specified channel in the provided state buffer.void
setADRange(int channel, double range, byte[] state)
Sets the A/D input range for the specified channel in the provided state buffer.void
setADResolution(int channel, double resolution, byte[] state)
Sets the A/D conversion resolution value for the specified channel in the provided state buffer.void
setFlag(int memAddr, byte flagToSet, boolean flagValue)
Sets one of the flags in one of the registers.
Valid registers are:PROTECTION_REGISTER
,STATUS_REGISTER
,EEPROM_REGISTER
andSPECIAL_FEATURE_REGISTER
.void
setLatchState(boolean on)
Sets the state for the Programmable Input/Output pin.void
setRemainingCapacity(double remainingCapacity)
Allows user to set the remaining capacity.void
setResistorExternal(double Rsens)
Sets the DS2760 to use an external, user-selectable resistance.void
setResistorInternal()
Sets the DS2760 to use its internal .025 ohm resistor for measurements.void
setTemperatureAlarm(int alarmType, double alarmValue, byte[] state)
Sets the temperature alarm value in degrees C in the provided state data.void
setTemperatureResolution(double resolution, byte[] state)
Sets the current temperature resolution in degrees C in the provided state data.void
writeByte(int memAddr, byte data)
Writes a register byte to the memory of the DS2760.void
writeDevice(byte[] state)
Writes the 1-Wire device sensor state that have been changed by the 'set' methods.void
writeEEPROMBlock(int blockNumber, byte[] data)
Writes a 16 byte data block to one of the user blocks.-
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString
-
-
-
-
Field Detail
-
PROTECTION_REGISTER
public static final byte PROTECTION_REGISTER
Address of the Protection Register. Used to set/check flags withsetFlag()/getFlag()
.- See Also:
- Constant Field Values
-
STATUS_REGISTER
public static final byte STATUS_REGISTER
Address of the Status Register. Used to set/check flags withsetFlag()/getFlag()
.- See Also:
- Constant Field Values
-
EEPROM_REGISTER
public static final byte EEPROM_REGISTER
Address of the EEPROM Register. Used to set/check flags withsetFlag()/getFlag()
.- See Also:
- Constant Field Values
-
SPECIAL_FEATURE_REGISTER
public static final byte SPECIAL_FEATURE_REGISTER
Address of the Special Feature Register (SFR). Used to check flags withgetFlag()
.- See Also:
- Constant Field Values
-
OVERVOLTAGE_FLAG
public static final byte OVERVOLTAGE_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
, it indicates that the battery pack has experienced an overvoltage condition. This flag must be reset! Accessed withgetFlag()
.- See Also:
- Constant Field Values
-
UNDERVOLTAGE_FLAG
public static final byte UNDERVOLTAGE_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
, the battery pack has experienced an undervoltage. This flag must be reset! Accessed withgetFlag()
- See Also:
- Constant Field Values
-
CHARGE_OVERCURRENT_FLAG
public static final byte CHARGE_OVERCURRENT_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
the battery has experienced a charge-direction overcurrent condition. This flag must be reset! Accessed withgetFlag()
- See Also:
- Constant Field Values
-
DISCHARGE_OVERCURRENT_FLAG
public static final byte DISCHARGE_OVERCURRENT_FLAG
PROTECTION REGISTER FLAG: When this flag istrue
the battery has experienced a discharge-direction overcurrent condition. This flag must bereset()
! Accessed withgetFlag()
- See Also:
- Constant Field Values
-
CC_PIN_STATE_FLAG
public static final byte CC_PIN_STATE_FLAG
PROTECTION REGISTER FLAG: Mirrors the !CC output pin. Accessed withgetFlag()
- See Also:
- Constant Field Values
-
DC_PIN_STATE_FLAG
public static final byte DC_PIN_STATE_FLAG
PROTECTION REGISTER FLAG: Mirrors the !DC output pin. Accessed withgetFlag()
- See Also:
- Constant Field Values
-
CHARGE_ENABLE_FLAG
public static final byte CHARGE_ENABLE_FLAG
PROTECTION REGISTER FLAG: Resetting this flag will disable charging regardless of cell or pack conditions. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
DISCHARGE_ENABLE_FLAG
public static final byte DISCHARGE_ENABLE_FLAG
PROTECTION REGISTER FLAG: Resetting this flag will disable discharging. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
SLEEP_MODE_ENABLE_FLAG
public static final byte SLEEP_MODE_ENABLE_FLAG
STATUS REGISTER FLAG: Enables/disables the DS2760 to enter sleep mode when the DQ line goes low for greater than 2 seconds. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
READ_NET_ADDRESS_OPCODE_FLAG
public static final byte READ_NET_ADDRESS_OPCODE_FLAG
STATUS REGISTER FLAG: If set, the opcode for the Read Net Address command will be set to 33h. If it is not set the opcode is set to 39h. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
EEPROM_COPY_FLAG
public static final byte EEPROM_COPY_FLAG
EEPROM REGISTER FLAG: This flag will betrue
if the Copy Data Command is in progress. Data may be written to EEPROM when this readsfalse
. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
EEPROM_LOCK_ENABLE_FLAG
public static final byte EEPROM_LOCK_ENABLE_FLAG
EEPROM REGISTER FLAG: When this flag istrue
, the Lock Command is enabled. The lock command is used to make memory permanently read only. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
EEPROM_BLOCK_1_LOCK_FLAG
public static final byte EEPROM_BLOCK_1_LOCK_FLAG
EEPROM REGISTER FLAG: When this flag istrue
, Block 1 of the EEPROM (addresses 48-63) is read-only. Accessed withgetFlag()
.- See Also:
- Constant Field Values
-
EEPROM_BLOCK_0_LOCK_FLAG
public static final byte EEPROM_BLOCK_0_LOCK_FLAG
EEPROM REGISTER FLAG: When this flag istrue
, Block 0 of the EEPROM (addresses 32-47) is read-only. Accessed withgetFlag()
.- See Also:
- Constant Field Values
-
PS_PIN_STATE_FLAG
public static final byte PS_PIN_STATE_FLAG
SPECIAL FEATURE REGISTER FLAG: Mirrors the state of the !PS pin. Accessed withgetFlag()
.- See Also:
- Constant Field Values
-
PIO_PIN_SENSE_AND_CONTROL_FLAG
public static final byte PIO_PIN_SENSE_AND_CONTROL_FLAG
SPECIAL FEATURE REGISTER FLAG: Mirrors/sets the state of the PIO pin. The PIO pin can be used as an output; resetting this flag disables the PIO output driver. Accessed withgetFlag()/setFlag()
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OneWireContainer30
public OneWireContainer30()
Default constructor
-
OneWireContainer30
public OneWireContainer30(DSPortAdapter sourceAdapter, byte[] newAddress)
Creates a container with a provided adapter object and the address of this 1-Wire device.- Parameters:
sourceAdapter
- adapter object required to communicate with this 1-Wire devicenewAddress
- address of this 1-Wire device
-
OneWireContainer30
public OneWireContainer30(DSPortAdapter sourceAdapter, long newAddress)
Creates a container with a provided adapter object and the address of this 1-Wire device.- Parameters:
sourceAdapter
- adapter object required to communicate with this 1-Wire devicenewAddress
- address of this 1-Wire device
-
OneWireContainer30
public OneWireContainer30(DSPortAdapter sourceAdapter, java.lang.String newAddress)
Creates a container with a provided adapter object and the address of this 1-Wire device.- Parameters:
sourceAdapter
- adapter object required to communicate with this 1-Wire devicenewAddress
- address of this 1-Wire device
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the Maxim Integrated Products part number of this 1-Wire device as a string.- Overrides:
getName
in classOneWireContainer
- Returns:
- representation of the 1-Wire device name
-
getAlternateNames
public java.lang.String getAlternateNames()
Returns the alternate Maxim Integrated Products part number or name. ie. Smart Battery Monitor- Overrides:
getAlternateNames
in classOneWireContainer
- Returns:
- representation of the alternate names for this device
-
getDescription
public java.lang.String getDescription()
Returns a short description of the function of this 1-Wire device type.- Overrides:
getDescription
in classOneWireContainer
- Returns:
- representation of the function description
-
getMemoryBanks
public java.util.Enumeration<MemoryBank> getMemoryBanks()
Get an enumeration of memory bank instances that implement one or more of the following interfaces:MemoryBank
,PagedMemoryBank
, andOTPMemoryBank
.- Overrides:
getMemoryBanks
in classOneWireContainer
- Returns:
Enumeration
of memory banks- See Also:
MemoryBank
-
setResistorInternal
public void setResistorInternal()
Sets the DS2760 to use its internal .025 ohm resistor for measurements. This should only be enabled if there is NO external resistor physically attached to the device.
-
setResistorExternal
public void setResistorExternal(double Rsens)
Sets the DS2760 to use an external, user-selectable resistance. This Resistance should be wired directly to the VSS (negative terminal of the cell).- Parameters:
Rsens
- resistance in ohms
-
readByte
public byte readByte(int memAddr) throws OneWireIOException, OneWireException
Reads a register byte from the memory of the DS2760. Note that there is no error checking as the DS2760 performs no CRC on the data.Note: This function should only be used when reading the register memory of the DS2760. The EEPROM blocks (addresses 32-64) should be accessed with writeBlock/readBlock.
- Parameters:
memAddr
- the address to read (0-255)- Returns:
- data read from memory
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
readBytes
public void readBytes(int memAddr, byte[] buffer, int start, int len) throws OneWireIOException, OneWireException
Reads bytes from the DS2760. Note that there is no error-checking as the DS2760 does not perform a CRC on the data.Note: This function should only be used when reading the register memory of the DS2760. The EEPROM blocks (addresses 32-64) should be accessed with writeBlock/readBlock.
- Parameters:
memAddr
- the address to read (0-255)buffer
- buffer to receive datastart
- start position within buffer to place datalen
- length of buffer- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
writeByte
public void writeByte(int memAddr, byte data) throws OneWireIOException, OneWireException
Writes a register byte to the memory of the DS2760. Note that the DS2760 does not make any use of cyclic redundancy checks (error-checking). To ensure error free transmission, double check write operation.Note: This method should only be used when writing to the register memory of the DS2760. The EEPROM blocks (addresses 32-64) require special treatment and thus the writeBlock/readBlock functions should be used for those.
- Parameters:
memAddr
- address to write (0-255)data
- data byte to write to memory- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find part
-
readEEPROMBlock
public byte[] readEEPROMBlock(int blockNumber) throws OneWireIOException, OneWireException
Reads a 16 byte data block from one of the user EEPROM blocks. Note that there is no error-checking as the DS2760 performs no CRCs.- Parameters:
blockNumber
- the EEPROM block number to read, acceptable parameters are 0 and 1- Returns:
- 16 data bytes
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
writeEEPROMBlock
public void writeEEPROMBlock(int blockNumber, byte[] data) throws OneWireIOException, OneWireException
Writes a 16 byte data block to one of the user blocks. The block may be rewritten at any time, except after it is locked withlockBlock()
. This method performs error checking by verifying data written.- Parameters:
blockNumber
- block to write, acceptable parameters are 0 and 1data
- 16 bytes of data to write- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find part
-
lockBlock
public void lockBlock(int blockNumber) throws OneWireIOException, OneWireException
Permanently write-protects one of the user blocks of EEPROM.- Parameters:
blockNumber
- block number to permanently write protect, acceptable parameters are 0 and 1.- Throws:
OneWireIOException
- Error locking blockOneWireException
- Could not find part
-
getFlag
public boolean getFlag(int memAddr, byte flagToGet) throws OneWireIOException, OneWireException
Checks the specified flag in the specified register.
Valid registers are:PROTECTION_REGISTER
,STATUS_REGISTER
,EEPROM_REGISTER
andSPECIAL_FEATURE_REGISTER
.- Parameters:
memAddr
- registers address. Predefined fields for each register are defined above.flagToGet
- bitmask of desired flag, the acceptable parameters pertaining to each register are defined as constant fields above- Returns:
- value of the flag:
true
if flag is set (=1) - Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
setFlag
public void setFlag(int memAddr, byte flagToSet, boolean flagValue) throws OneWireIOException, OneWireException
Sets one of the flags in one of the registers.
Valid registers are:PROTECTION_REGISTER
,STATUS_REGISTER
,EEPROM_REGISTER
andSPECIAL_FEATURE_REGISTER
.- Parameters:
memAddr
- register address, these addresses are predefined aboveflagToSet
- bitmask of flag to set, valid parameters pertaining to each register are defined as constant fields aboveflagValue
- value to set the flag to- Throws:
OneWireIOException
- Error setting flagOneWireException
- Could not find part
-
getCurrent
public double getCurrent(byte[] state) throws OneWireIOException, OneWireException
Gets the instantaneous current.- Parameters:
state
- device state- Returns:
- current in Amperes
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
setRemainingCapacity
public void setRemainingCapacity(double remainingCapacity) throws OneWireIOException, OneWireException
Allows user to set the remaining capacity. Good for accurate capacity measurements using temperature and battery life.By measuring the battery's current and voltage when it is fully charged and when it is empty, the voltage corresponding to an empty battery and the current corresponding to a full one can be derived. These values can be detected in user program and the remaining capacity can be set to the empty/full levels accordingly for nice accuracy.
- Parameters:
remainingCapacity
- remaining capacity in mAH- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
getRemainingCapacity
public double getRemainingCapacity(byte[] state) throws OneWireIOException, OneWireException
Calculates the remaining capacity in mAHours from the current Accumulator. Accurate to +/- .25 mAH.- Parameters:
state
- device state- Returns:
- mAHours of battery capacity remaining
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
setLatchState
public void setLatchState(boolean on) throws OneWireIOException, OneWireException
Sets the state for the Programmable Input/Output pin. In order to operate as a switch, PIO must be tied to a pull-up resistor to VDD.- Parameters:
on
- state of the PIO pin to set- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find part
-
getLatchState
public boolean getLatchState() throws OneWireIOException, OneWireException
Returns the latch state of the Programmable Input/Output pin on the DS2760.- Returns:
- state of the Programmable Input/Output pin
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find part
-
clearConditions
public void clearConditions() throws OneWireIOException, OneWireException
Clears the overvoltage, undervoltage, charge overcurrent, and discharge overcurrent flags. Each time a violation occurs, these flags stay set until reset. This method resets all 4 flags.- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find part
-
getNumberADChannels
public int getNumberADChannels()
Queries to get the number of channels supported by this A/D device. Channel specific methods will use a channel number specified by an integer from[0 to (getNumberChannels() - 1)]
.- Specified by:
getNumberADChannels
in interfaceADContainer
- Returns:
- number of channels
-
hasADAlarms
public boolean hasADAlarms()
Queries to see if this A/D measuring device has high/low alarms.- Specified by:
hasADAlarms
in interfaceADContainer
- Returns:
true
if has high/low trips
-
getADRanges
public double[] getADRanges(int channel)
Queries to get an array of available ranges for the specified A/D channel.- Specified by:
getADRanges
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
- Returns:
- available ranges
- See Also:
ADContainer.getNumberADChannels()
-
getADResolutions
public double[] getADResolutions(int channel, double range)
Queries to get an array of available resolutions based on the specified range on the specified A/D channel.- Specified by:
getADResolutions
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
range
- range of channel specified in channel parameter- Returns:
- available resolutions
- See Also:
ADContainer.getNumberADChannels()
,ADContainer.getADRanges(int)
-
canADMultiChannelRead
public boolean canADMultiChannelRead()
Queries to see if this A/D device supports doing multiple voltage conversions at the same time.- Specified by:
canADMultiChannelRead
in interfaceADContainer
- Returns:
true
if can do multi-channel voltage reads- See Also:
ADContainer.doADConvert(boolean[],byte[])
-
doADConvert
public void doADConvert(int channel, byte[] state) throws OneWireIOException, OneWireException
Performs voltage conversion on the specified channel. The methodgetADVoltage()
can be used to read the result of the conversion.- Specified by:
doADConvert
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
state
- current state of this device returned fromreadDevice()
- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find device- See Also:
OneWireSensor.readDevice()
,ADContainer.getADVoltage(int,byte[])
-
doADConvert
public void doADConvert(boolean[] doConvert, byte[] state) throws OneWireIOException, OneWireException
Performs voltage conversion on all specified channels. The methodgetADVoltage()
can be used to read the result of the conversion. This A/D must support multi-channel readcanMultiChannelRead()
if there are more than 1 channel is specified.- Specified by:
doADConvert
in interfaceADContainer
- Parameters:
doConvert
- channels to perform conversion onstate
- current state of the device returned fromreadDevice()
- Throws:
OneWireIOException
- Error writing dataOneWireException
- Device does not support multi-channel reading- See Also:
OneWireSensor.readDevice()
,ADContainer.getADVoltage(byte[])
,ADContainer.canADMultiChannelRead()
-
getADVoltage
public double[] getADVoltage(byte[] state) throws OneWireIOException, OneWireException
Reads the voltage values. Must be used after adoADConvert()
method call. Also must include the last valid state from thereadDevice()
method and this A/D must support multi-channel readcanMultiChannelRead()
if there are more than 1 channel.- Specified by:
getADVoltage
in interfaceADContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- voltage values for all channels
- Throws:
OneWireIOException
- Error writing dataOneWireException
- Device does not support multi-channel reading- See Also:
ADContainer.doADConvert(boolean[],byte[])
-
getADVoltage
public double getADVoltage(int channel, byte[] state) throws OneWireIOException, OneWireException
Reads a channel voltage value. Must be used after adoADConvert()
method call. Also must include the last valid state from thereadDevice()
method. Note, if more than one channel is to be read then it is more efficient to use thegetADVoltage(byte[])
method that returns all channel values.- Specified by:
getADVoltage
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
state
- current state of the device returned fromreadDevice()
- Returns:
- voltage value for the specified channel
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find device- See Also:
ADContainer.doADConvert(int,byte[])
,ADContainer.getADVoltage(byte[])
-
getADAlarm
public double getADAlarm(int channel, int alarmType, byte[] state) throws OneWireException
Extracts the alarm voltage value of the specified channel from the provided state buffer. The state buffer is retrieved from thereadDevice()
method.- Specified by:
getADAlarm
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm,ALARM_HIGH (1) or ALARM_LOW (0)
state
- current state of the device returned fromreadDevice()
- Returns:
- alarm_value in volts
- Throws:
OneWireException
- Device does not support A/D alarms- See Also:
OneWireSensor.readDevice()
,ADContainer.hasADAlarms()
-
getADAlarmEnable
public boolean getADAlarmEnable(int channel, int alarmType, byte[] state) throws OneWireException
Extracts the alarm enable value of the specified channel from the provided state buffer. The state buffer is retrieved from thereadDevice()
method.- Specified by:
getADAlarmEnable
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm,ALARM_HIGH (1) or ALARM_LOW (0)
state
- current state of the device returned fromreadDevice()
- Returns:
true
if specified alarm is enabled- Throws:
OneWireException
- Device does not support A/D alarms- See Also:
OneWireSensor.readDevice()
,ADContainer.hasADAlarms()
-
hasADAlarmed
public boolean hasADAlarmed(int channel, int alarmType, byte[] state) throws OneWireException
Checks the A/D alarm event value of the specified channel from the provided state buffer. The state buffer is retrieved from thereadDevice()
method.- Specified by:
hasADAlarmed
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm,ALARM_HIGH (1) or ALARM_LOW (0)
state
- current state of the device returned fromreadDevice()
- Returns:
true
if specified alarm occurred- Throws:
OneWireException
- Device does not support A/D alarms- See Also:
OneWireSensor.readDevice()
,ADContainer.hasADAlarms()
,ADContainer.getADAlarmEnable(int,int,byte[])
,ADContainer.setADAlarmEnable(int,int,boolean,byte[])
-
getADResolution
public double getADResolution(int channel, byte[] state)
Extracts the A/D conversion resolution of the specified channel from the provided state buffer expressed in volts. The state is retrieved from thereadDevice()
method.- Specified by:
getADResolution
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
state
- current state of the device returned fromreadDevice()
- Returns:
- A/D resolution of channel in volts
- See Also:
ADContainer.getADResolutions(int,double)
,ADContainer.setADResolution(int,double,byte[])
-
getADRange
public double getADRange(int channel, byte[] state)
Extracts the A/D input voltage range of the specified channel from the provided state buffer. The state buffer is retrieved from thereadDevice()
method.- Specified by:
getADRange
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
state
- current state of the device returned fromreadDevice()
- Returns:
- A/D input voltage range
- See Also:
ADContainer.getADRanges(int)
,ADContainer.setADRange(int,double,byte[])
-
setADAlarm
public void setADAlarm(int channel, int alarmType, double alarm, byte[] state) throws OneWireException
Sets the A/D alarm voltage value of the specified channel in the provided state buffer. The state buffer is retrieved from thereadDevice()
method. The methodwriteDevice()
must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
.- Specified by:
setADAlarm
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm,ALARM_HIGH (1) or ALARM_LOW (0)
alarm
- A/D alarm value (will be reduced to 8 bit resolution)state
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
- Device does not support A/D alarms- See Also:
OneWireSensor.writeDevice(byte[])
,ADContainer.hasADAlarms()
,ADContainer.getADAlarm(int,int,byte[])
,ADContainer.getADAlarmEnable(int,int,byte[])
,ADContainer.setADAlarmEnable(int,int,boolean,byte[])
,ADContainer.hasADAlarmed(int,int,byte[])
-
setADAlarmEnable
public void setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state) throws OneWireException
Sets the A/D alarm enable value of the specified channel in the provided state buffer. The state buffer is retrieved from thereadDevice()
method. The methodwriteDevice()
must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
.- Specified by:
setADAlarmEnable
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm,ALARM_HIGH (1) or ALARM_LOW (0)
alarmEnable
- A/D alarm enable valuestate
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
- Device does not support A/D alarms- See Also:
OneWireSensor.writeDevice(byte[])
,ADContainer.hasADAlarms()
,ADContainer.getADAlarm(int,int,byte[])
,ADContainer.setADAlarm(int,int,double,byte[])
,ADContainer.getADAlarmEnable(int,int,byte[])
,ADContainer.hasADAlarmed(int,int,byte[])
-
setADResolution
public void setADResolution(int channel, double resolution, byte[] state)
Sets the A/D conversion resolution value for the specified channel in the provided state buffer. The state buffer is retrieved from thereadDevice()
method. The methodwriteDevice()
must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
.- Specified by:
setADResolution
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
resolution
- A/D resolution in voltsstate
- current state of the device returned fromreadDevice()
- See Also:
ADContainer.getADResolutions(int,double)
,ADContainer.getADResolution(int,byte[])
-
setADRange
public void setADRange(int channel, double range, byte[] state)
Sets the A/D input range for the specified channel in the provided state buffer. The state buffer is retrieved from thereadDevice()
method. The methodwriteDevice()
must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
.- Specified by:
setADRange
in interfaceADContainer
- Parameters:
channel
- channel in the range[0 to (getNumberChannels() - 1)]
range
- max A/D volt range, usegetRanges()
method to get available rangesstate
- current state of the device returned fromreadDevice()
- See Also:
ADContainer.getADRanges(int)
,ADContainer.getADRange(int,byte[])
-
hasTemperatureAlarms
public boolean hasTemperatureAlarms()
Queries to see if this temperature measuring device has high/low trip alarms.- Specified by:
hasTemperatureAlarms
in interfaceTemperatureContainer
- Returns:
true
if has high/low temperature trip alarms- See Also:
TemperatureContainer.getTemperatureAlarm(int, byte[])
,TemperatureContainer.setTemperatureAlarm(int, double, byte[])
-
hasSelectableTemperatureResolution
public boolean hasSelectableTemperatureResolution()
Queries to see if this device has selectable temperature resolution.- Specified by:
hasSelectableTemperatureResolution
in interfaceTemperatureContainer
- Returns:
true
if has selectable temperature resolution- See Also:
TemperatureContainer.getTemperatureResolution(byte[])
,TemperatureContainer.getTemperatureResolutions()
,TemperatureContainer.setTemperatureResolution(double, byte[])
-
getTemperatureResolutions
public double[] getTemperatureResolutions()
Queries to get an array of available temperature resolutions in degrees C.- Specified by:
getTemperatureResolutions
in interfaceTemperatureContainer
- Returns:
- available temperature resolutions in degrees C
- See Also:
TemperatureContainer.hasSelectableTemperatureResolution()
,TemperatureContainer.getTemperatureResolution(byte[])
,TemperatureContainer.setTemperatureResolution(double, byte[])
-
getTemperatureAlarmResolution
public double getTemperatureAlarmResolution() throws OneWireException
Queries to get the high/low temperature alarm resolution in degrees C.- Specified by:
getTemperatureAlarmResolution
in interfaceTemperatureContainer
- Returns:
- high/low temperature alarm resolution in degrees C
- Throws:
OneWireException
- Device does not support temperature alarms- See Also:
TemperatureContainer.hasTemperatureAlarms()
,TemperatureContainer.getTemperatureAlarm(int, byte[])
,TemperatureContainer.setTemperatureAlarm(int, double, byte[])
-
getMaxTemperature
public double getMaxTemperature()
Queries to get the maximum temperature in degrees C.- Specified by:
getMaxTemperature
in interfaceTemperatureContainer
- Returns:
- maximum temperature in degrees C
-
getMinTemperature
public double getMinTemperature()
Queries to get the minimum temperature in degrees C.- Specified by:
getMinTemperature
in interfaceTemperatureContainer
- Returns:
- minimum temperature in degrees C
-
doTemperatureConvert
public void doTemperatureConvert(byte[] state) throws OneWireIOException, OneWireException
Performs a temperature conversion.- Specified by:
doTemperatureConvert
in interfaceTemperatureContainer
- Parameters:
state
- device state- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find device
-
getTemperature
public double getTemperature(byte[] state)
Extracts the temperature value in degrees C from the state data retrieved from thereadDevice()
method.- Specified by:
getTemperature
in interfaceTemperatureContainer
- Parameters:
state
- device state- Returns:
- temperature in degrees C from the last
doTemperatureConvert()
-
getTemperatureAlarm
public double getTemperatureAlarm(int alarmType, byte[] state) throws OneWireException
Extracts the specified temperature alarm value in degrees C from the state data retrieved from thereadDevice()
method.- Specified by:
getTemperatureAlarm
in interfaceTemperatureContainer
- Parameters:
alarmType
- trip typeALARM_HIGH (1) or ALARM_LOW (0)
state
- device state- Returns:
- alarm trip temperature in degrees C
- Throws:
OneWireException
- Device does not support temperature alarms- See Also:
TemperatureContainer.hasTemperatureAlarms()
,TemperatureContainer.setTemperatureAlarm(int, double, byte[])
-
getTemperatureResolution
public double getTemperatureResolution(byte[] state)
Extracts the current temperature resolution in degrees C from the state data retrieved from thereadDevice()
method.- Specified by:
getTemperatureResolution
in interfaceTemperatureContainer
- Parameters:
state
- device state- Returns:
- temperature resolution in degrees C
- See Also:
TemperatureContainer.hasSelectableTemperatureResolution()
,TemperatureContainer.getTemperatureResolutions()
,TemperatureContainer.setTemperatureResolution(double, byte[])
-
setTemperatureAlarm
public void setTemperatureAlarm(int alarmType, double alarmValue, byte[] state) throws OneWireException, OneWireIOException
Sets the temperature alarm value in degrees C in the provided state data. Use the methodwriteDevice()
with this data to finalize the change to the device.- Specified by:
setTemperatureAlarm
in interfaceTemperatureContainer
- Parameters:
alarmType
- trip typeALARM_HIGH (1) or ALARM_LOW (0)
alarmValue
- high/low temperature trip value in degrees Cstate
- device state- Throws:
OneWireIOException
- Error writing dataOneWireException
- Device does not support temperature alarms- See Also:
TemperatureContainer.hasTemperatureAlarms()
,TemperatureContainer.getTemperatureAlarm(int, byte[])
-
setTemperatureResolution
public void setTemperatureResolution(double resolution, byte[] state) throws OneWireException, OneWireIOException
Sets the current temperature resolution in degrees C in the provided state data. Use the methodwriteDevice()
with this data to finalize the change to the device.- Specified by:
setTemperatureResolution
in interfaceTemperatureContainer
- Parameters:
resolution
- temperature resolution in degrees Cstate
- device state- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find device- See Also:
TemperatureContainer.hasSelectableTemperatureResolution()
,TemperatureContainer.getTemperatureResolution(byte[])
,TemperatureContainer.getTemperatureResolutions()
-
readDevice
public byte[] readDevice() throws OneWireIOException, OneWireException
Retrieves the 1-Wire device sensor state. This state is returned as a byte array. Pass this byte array to the static query and set methods. If the device state needs to be changed then call thewriteDevice()
to finalize the one or more change. With the DS2760, there are no CRC checks on data. To ensure the integrity of this data, call twice and make sure only fields expected to change have changed. This method returns bytes 0 to 31 of the memory. Many applications will not need to worry about the lack of CRC checks.- Specified by:
readDevice
in interfaceOneWireSensor
- Returns:
- 1-Wire device state
- Throws:
OneWireIOException
- Error reading dataOneWireException
- Could not find device
-
writeDevice
public void writeDevice(byte[] state) throws OneWireIOException, OneWireException
Writes the 1-Wire device sensor state that have been changed by the 'set' methods. It knows which registers have changed by looking at the bitmap fields appended to the state data.- Specified by:
writeDevice
in interfaceOneWireSensor
- Parameters:
state
- device state- Throws:
OneWireIOException
- Error writing dataOneWireException
- Could not find device
-
-