Class 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
    • Constructor Summary

      Constructors 
      Constructor Description
      OneWireContainer30()
      Default constructor
      OneWireContainer30​(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, and OTPMemoryBank.
      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 the readDevice() method.
      double getTemperatureAlarm​(int alarmType, byte[] state)
      Extracts the specified temperature alarm value in degrees C from the state data retrieved from the readDevice() 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 the readDevice() 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 and SPECIAL_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 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PROTECTION_REGISTER

        public static final byte PROTECTION_REGISTER
        Address of the Protection Register. Used to set/check flags with setFlag()/getFlag().
        See Also:
        Constant Field Values
      • STATUS_REGISTER

        public static final byte STATUS_REGISTER
        Address of the Status Register. Used to set/check flags with setFlag()/getFlag().
        See Also:
        Constant Field Values
      • EEPROM_REGISTER

        public static final byte EEPROM_REGISTER
        Address of the EEPROM Register. Used to set/check flags with setFlag()/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 with getFlag().
        See Also:
        Constant Field Values
      • OVERVOLTAGE_FLAG

        public static final byte OVERVOLTAGE_FLAG
        PROTECTION REGISTER FLAG: When this flag is true, it indicates that the battery pack has experienced an overvoltage condition. This flag must be reset! Accessed with getFlag().
        See Also:
        Constant Field Values
      • UNDERVOLTAGE_FLAG

        public static final byte UNDERVOLTAGE_FLAG
        PROTECTION REGISTER FLAG: When this flag is true, the battery pack has experienced an undervoltage. This flag must be reset! Accessed with getFlag()
        See Also:
        Constant Field Values
      • CHARGE_OVERCURRENT_FLAG

        public static final byte CHARGE_OVERCURRENT_FLAG
        PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a charge-direction overcurrent condition. This flag must be reset! Accessed with getFlag()
        See Also:
        Constant Field Values
      • DISCHARGE_OVERCURRENT_FLAG

        public static final byte DISCHARGE_OVERCURRENT_FLAG
        PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a discharge-direction overcurrent condition. This flag must be reset()! Accessed with getFlag()
        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 with getFlag()
        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 with getFlag()
        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 with getFlag()/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 with getFlag()/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 with getFlag()/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 with getFlag()/setFlag().
        See Also:
        Constant Field Values
      • EEPROM_COPY_FLAG

        public static final byte EEPROM_COPY_FLAG
        EEPROM REGISTER FLAG: This flag will be true if the Copy Data Command is in progress. Data may be written to EEPROM when this reads false. Accessed with getFlag()/setFlag().
        See Also:
        Constant Field Values
      • EEPROM_LOCK_ENABLE_FLAG

        public static final byte EEPROM_LOCK_ENABLE_FLAG
        EEPROM REGISTER FLAG: When this flag is true, the Lock Command is enabled. The lock command is used to make memory permanently read only. Accessed with getFlag()/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 is true, Block 1 of the EEPROM (addresses 48-63) is read-only. Accessed with getFlag().
        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 is true, Block 0 of the EEPROM (addresses 32-47) is read-only. Accessed with getFlag().
        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 with getFlag().
        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 with getFlag()/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 device
        newAddress - 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 device
        newAddress - 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 device
        newAddress - address of this 1-Wire device