1-Wire API for .NET Version 4.00
Public Member Functions | Static Public Attributes

OneWireContainer30 Class Reference

Inherits com::dalsemi::onewire::container::OneWireContainer, com::dalsemi::onewire::container::ADContainer, and com::dalsemi::onewire::container::TemperatureContainer.

List of all members.

Public Member Functions

 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, String newAddress)
 Creates a container with a provided adapter object and the address of this 1-Wire device.
String getName ()
 Returns the Maxim Integrated Products part number of this 1-Wire device as a string.
String getAlternateNames ()
 Returns the alternate Maxim Integrated Products part number or name.
String getDescription ()
 Returns a short description of the function of this 1-Wire device type.
Enumeration getMemoryBanks ()
 Get an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank, PagedMemoryBank, and OTPMemoryBank.
synchronized void setResistorInternal ()
 Sets the DS2760 to use its internal .025 ohm resistor for measurements.
synchronized void setResistorExternal (double Rsens)
 Sets the DS2760 to use an external, user-selectable resistance.
byte readByte (int memAddr) throws OneWireIOException, OneWireException
 Reads a register byte from the memory of the DS2760.
void readBytes (int memAddr, byte[] buffer, int start, int len) throws OneWireIOException, OneWireException
 Reads bytes from the DS2760.
void writeByte (int memAddr, byte data) throws OneWireIOException, OneWireException
 Writes a register byte to the memory of the DS2760.
byte[] readEEPROMBlock (int blockNumber) throws OneWireIOException, OneWireException
 Reads a 16 byte data block from one of the user EEPROM blocks.
void writeEEPROMBlock (int blockNumber, byte[] data) throws OneWireIOException, OneWireException
 Writes a 16 byte data block to one of the user blocks.
void lockBlock (int blockNumber) throws OneWireIOException, OneWireException
 Permanently write-protects one of the user blocks of EEPROM.
boolean getFlag (int memAddr, byte flagToGet) throws OneWireIOException, OneWireException
 Checks the specified flag in the specified register.
void setFlag (int memAddr, byte flagToSet, boolean flagValue) throws OneWireIOException, OneWireException
 Sets one of the flags in one of the registers.
double getCurrent (byte[] state) throws OneWireIOException, OneWireException
 Gets the instantaneous current.
void setRemainingCapacity (double remainingCapacity) throws OneWireIOException, OneWireException
 Allows user to set the remaining capacity.
double getRemainingCapacity (byte[] state) throws OneWireIOException, OneWireException
 Calculates the remaining capacity in mAHours from the current Accumulator.
void setLatchState (boolean on) throws OneWireIOException, OneWireException
 Sets the state for the Programmable Input/Output pin.
boolean getLatchState () throws OneWireIOException, OneWireException
 Returns the latch state of the Programmable Input/Ouput pin on the DS2760.
void clearConditions () throws OneWireIOException, OneWireException
 Clears the overvoltage, undervoltage, charge overcurrent, and discharge overcurrent flags.
int getNumberADChannels ()
 Queries to get the number of channels supported by this A/D device.
boolean hasADAlarms ()
 Queries to see if this A/D measuring device has high/low alarms.
double[] getADRanges (int channel)
 Queries to get an array of available ranges for the specified A/D channel.
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.
boolean canADMultiChannelRead ()
 Queries to see if this A/D device supports doing multiple voltage conversions at the same time.
void doADConvert (int channel, byte[] state) throws OneWireIOException, OneWireException
 Performs voltage conversion on the specified channel.
void doADConvert (boolean[] doConvert, byte[] state) throws OneWireIOException, OneWireException
 Performs voltage conversion on all specified channels.
double[] getADVoltage (byte[] state) throws OneWireIOException, OneWireException
 Reads the voltage values.
double getADVoltage (int channel, byte[] state) throws OneWireIOException, OneWireException
 Reads a channel voltage value.
double getADAlarm (int channel, int alarmType, byte[] state) throws OneWireException
 Extracts the alarm voltage value of the specified channel from the provided state buffer.
boolean getADAlarmEnable (int channel, int alarmType, byte[] state) throws OneWireException
 Extracts the alarm enable value of the specified channel from the provided state buffer.
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.
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 getADRange (int channel, byte[] state)
 Extracts the A/D input voltage range of the specified channel from the provided state buffer.
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.
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.
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 setADRange (int channel, double range, byte[] state)
 Sets the A/D input range for the specified channel in the provided state buffer.
boolean hasTemperatureAlarms ()
 Queries to see if this temperature measuring device has high/low trip alarms.
boolean hasSelectableTemperatureResolution ()
 Queries to see if this device has selectable temperature resolution.
double[] getTemperatureResolutions ()
 Queries to get an array of available temperature resolutions in degrees C.
double getTemperatureAlarmResolution () throws OneWireException
 Queries to get the high/low temperature alarm resolution in degrees C.
double getMaxTemperature ()
 Queries to get the maximum temperature in degrees C.
double getMinTemperature ()
 Queries to get the minimum temperature in degrees C.
void doTemperatureConvert (byte[] state) throws OneWireIOException, OneWireException
 Performs a temperature conversion.
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) throws OneWireException
 Extracts the specified temperature alarm value in degrees C from the state data retrieved from the readDevice() method.
double getTemperatureResolution (byte[] state)
 Extracts the current temperature resolution in degrees C from the state data retrieved from the readDevice() method.
void setTemperatureAlarm (int alarmType, double alarmValue, byte[] state) throws OneWireException, OneWireIOException
 Sets the temperature alarm value in degrees C in the provided state data.
void setTemperatureResolution (double resolution, byte[] state) throws OneWireException, OneWireIOException
 Sets the current temperature resolution in degrees C in the provided state data.
byte[] readDevice () throws OneWireIOException, OneWireException
 Retrieves the 1-Wire device sensor state.
void writeDevice (byte[] state) throws OneWireIOException, OneWireException
 Writes the 1-Wire device sensor state that have been changed by the 'set' methods.

Static Public Attributes

static final byte PROTECTION_REGISTER = 0
 Address of the Protection Register.
static final byte STATUS_REGISTER = 1
 Address of the Status Register.
static final byte EEPROM_REGISTER = 7
 Address of the EEPROM Register.
static final byte SPECIAL_FEATURE_REGISTER = 8
 Address of the Special Feature Register (SFR).
static final byte OVERVOLTAGE_FLAG = ( byte ) 128
 PROTECTION REGISTER FLAG: When this flag is true, it indicates that the battery pack has experienced an overvoltage condition.
static final byte UNDERVOLTAGE_FLAG = 64
 PROTECTION REGISTER FLAG: When this flag is true, the battery pack has experienced an undervoltage.
static final byte CHARGE_OVERCURRENT_FLAG = 32
 PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a charge-direction overcurrent condition.
static final byte DISCHARGE_OVERCURRENT_FLAG = 16
 PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a discharge-direction overcurrent condition.
static final byte CC_PIN_STATE_FLAG = 8
 PROTECTION REGISTER FLAG: Mirrors the !CC output pin.
static final byte DC_PIN_STATE_FLAG = 4
 PROTECTION REGISTER FLAG: Mirrors the !DC output pin.
static final byte CHARGE_ENABLE_FLAG = 2
 PROTECTION REGISTER FLAG: Reseting this flag will disable charging regardless of cell or pack conditions.
static final byte DISCHARGE_ENABLE_FLAG = 1
 PROTECTION REGISTER FLAG: Reseting this flag will disable discharging.
static final byte SLEEP_MODE_ENABLE_FLAG = 32
 STATUS REGISTER FLAG: Enables/disables the DS2760 to enter sleep mode when the DQ line goes low for greater than 2 seconds.
static final byte READ_NET_ADDRESS_OPCODE_FLAG = 16
 STATUS REGISTER FLAG: If set, the opcode for the Read Net Address command will be set to 33h.
static final byte EEPROM_COPY_FLAG = ( byte ) 128
 EEPROM REGISTER FLAG: This flag will be true if the Copy Data Command is in progress.
static final byte EEPROM_LOCK_ENABLE_FLAG = 64
 EEPROM REGISTER FLAG: When this flag is true, the Lock Command is enabled.
static final byte EEPROM_BLOCK_1_LOCK_FLAG = 2
 EEPROM REGISTER FLAG: When this flag is true, Block 1 of the EEPROM (addresses 48-63) is read-only.
static final byte EEPROM_BLOCK_0_LOCK_FLAG = 1
 EEPROM REGISTER FLAG: When this flag is true, Block 0 of the EEPROM (addresses 32-47) is read-only.
static final byte PS_PIN_STATE_FLAG = ( byte ) 128
 SPECIAL FEATURE REGISTER FLAG: Mirrors the state of the !PS pin.
static final byte PIO_PIN_SENSE_AND_CONTROL_FLAG = 64
 SPECIAL FEATURE REGISTER FLAG: Mirrors/sets the state of the PIO pin.

Detailed Description

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

Data sheet

http://pdfserv.maxim-ic.com/arpdf/DS2760.pdf

Version:
0.00, 28 Aug 2000
Author:
COlmstea

Converted to use interfaces, general rework KLA


Constructor & Destructor Documentation

OneWireContainer30 ( DSPortAdapter  sourceAdapter,
byte[]  newAddress 
)

Creates a container with a provided adapter object and the address of this 1-Wire device.

Parameters:
sourceAdapteradapter object required to communicate with this 1-Wire device
newAddressaddress 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.

Parameters:
sourceAdapteradapter object required to communicate with this 1-Wire device
newAddressaddress of this 1-Wire device
OneWireContainer30 ( DSPortAdapter  sourceAdapter,
String  newAddress 
)

Creates a container with a provided adapter object and the address of this 1-Wire device.

Parameters:
sourceAdapteradapter object required to communicate with this 1-Wire device
newAddressaddress of this 1-Wire device

Member Function Documentation

boolean canADMultiChannelRead ( )

Queries to see if this A/D device supports doing multiple voltage conversions at the same time.

Returns:
true if can do multi-channel voltage reads

Implements ADContainer.

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.

Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionCould not find part
void doADConvert ( int  channel,
byte[]  state 
) throws OneWireIOException, OneWireException

Performs voltage conversion on the specified channel.

The method getADVoltage() can be used to read the result of the conversion.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
statecurrent state of this device returned from readDevice()
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionCould not find device

Implements ADContainer.

void doADConvert ( boolean[]  doConvert,
byte[]  state 
) throws OneWireIOException, OneWireException

Performs voltage conversion on all specified channels.

The method getADVoltage() can be used to read the result of the conversion. This A/D must support multi-channel read canMultiChannelRead() if there are more than 1 channel is specified.

Parameters:
doConvertchannels to perform conversion on
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionDevice does not support multi-channel reading

Implements ADContainer.

void doTemperatureConvert ( byte[]  state) throws OneWireIOException, OneWireException

Performs a temperature conversion.

Parameters:
statedevice state
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionCould not find device

Implements TemperatureContainer.

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 the readDevice() method.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
alarmTypedesired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
statecurrent state of the device returned from readDevice()
Returns:
alarm_value in volts
Exceptions:
OneWireExceptionDevice does not support A/D alarms

Implements ADContainer.

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 the readDevice() method.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
alarmTypedesired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
statecurrent state of the device returned from readDevice()
Returns:
true if specified alarm is enabled
Exceptions:
OneWireExceptionDevice does not support A/D alarms

Implements ADContainer.

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 the readDevice() method.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
statecurrent state of the device returned from readDevice()
Returns:
A/D input voltage range

Implements ADContainer.

double [] getADRanges ( int  channel)

Queries to get an array of available ranges for the specified A/D channel.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
Returns:
available ranges

Implements ADContainer.

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 the readDevice() method.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
statecurrent state of the device returned from readDevice()
Returns:
A/D resolution of channel in volts

Implements ADContainer.

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.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
rangerange of channel specified in channel parameter
Returns:
available resolutions

Implements ADContainer.

double getADVoltage ( int  channel,
byte[]  state 
) throws OneWireIOException, OneWireException

Reads a channel voltage value.

Must be used after a doADConvert() method call. Also must include the last valid state from the readDevice() method. Note, if more than one channel is to be read then it is more efficient to use the getADVoltage(byte[]) method that returns all channel values.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
statecurrent state of the device returned from readDevice()
Returns:
voltage value for the specified channel
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find device

Implements ADContainer.

double [] getADVoltage ( byte[]  state) throws OneWireIOException, OneWireException

Reads the voltage values.

Must be used after a doADConvert() method call. Also must include the last valid state from the readDevice() method and this A/D must support multi-channel read canMultiChannelRead() if there are more than 1 channel.

Parameters:
statecurrent state of the device returned from readDevice()
Returns:
voltage values for all channels
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionDevice does not support multi-channel reading

Implements ADContainer.

String getAlternateNames ( )

Returns the alternate Maxim Integrated Products part number or name.

ie. Smart Battery Monitor

Returns:
representation of the alternate names for this device

Reimplemented from OneWireContainer.

double getCurrent ( byte[]  state) throws OneWireIOException, OneWireException

Gets the instantaneous current.

Parameters:
statedevice state
Returns:
current in Amperes
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
String getDescription ( )

Returns a short description of the function of this 1-Wire device type.

Returns:
representation of the function description

Reimplemented from OneWireContainer.

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 and SPECIAL_FEATURE_REGISTER.

Parameters:
memAddrregisters address. Pre-defined fields for each register are defined above.
flagToGetbitmask 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)
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
boolean getLatchState ( ) throws OneWireIOException, OneWireException

Returns the latch state of the Programmable Input/Ouput pin on the DS2760.

Returns:
state of the Programmable Input/Ouput pin
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
double getMaxTemperature ( )

Queries to get the maximum temperature in degrees C.

Returns:
maximum temperature in degrees C

Implements TemperatureContainer.

Enumeration getMemoryBanks ( )

Get an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank, PagedMemoryBank, and OTPMemoryBank.

Returns:
Enumeration of memory banks

Reimplemented from OneWireContainer.

double getMinTemperature ( )

Queries to get the minimum temperature in degrees C.

Returns:
minimum temperature in degrees C

Implements TemperatureContainer.

String getName ( )

Returns the Maxim Integrated Products part number of this 1-Wire device as a string.

Returns:
representation of the 1-Wire device name

Reimplemented from OneWireContainer.

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)].

Returns:
number of channels

Implements ADContainer.

double getRemainingCapacity ( byte[]  state) throws OneWireIOException, OneWireException

Calculates the remaining capacity in mAHours from the current Accumulator.

Accurate to +/- .25 mAH.

Parameters:
statedevice state
Returns:
mAHours of battery capacity remaining
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
double getTemperature ( byte[]  state)

Extracts the temperature value in degrees C from the state data retrieved from the readDevice() method.

Parameters:
statedevice state
Returns:
temperature in degrees C from the last doTemperatureConvert()

Implements TemperatureContainer.

double getTemperatureAlarm ( int  alarmType,
byte[]  state 
) throws OneWireException

Extracts the specified temperature alarm value in degrees C from the state data retrieved from the readDevice() method.

Parameters:
alarmTypetrip type ALARM_HIGH (1) or ALARM_LOW (0)
statedevice state
Returns:
alarm trip temperature in degrees C
Exceptions:
OneWireExceptionDevice does not support temerature alarms

Implements TemperatureContainer.

double getTemperatureAlarmResolution ( ) throws OneWireException

Queries to get the high/low temperature alarm resolution in degrees C.

Returns:
high/low temperature alarm resolution in degrees C
Exceptions:
OneWireExceptionDevice does not support temperature alarms

Implements TemperatureContainer.

double getTemperatureResolution ( byte[]  state)

Extracts the current temperature resolution in degrees C from the state data retrieved from the readDevice() method.

Parameters:
statedevice state
Returns:
temperature resolution in degrees C

Implements TemperatureContainer.

double [] getTemperatureResolutions ( )

Queries to get an array of available temperature resolutions in degrees C.

Returns:
available temperature resolutions in degrees C

Implements TemperatureContainer.

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 the readDevice() method.

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
alarmTypedesired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
statecurrent state of the device returned from readDevice()
Returns:
true if specified alarm occurred
Exceptions:
OneWireExceptionDevice does not support A/D alarms

Implements ADContainer.

boolean hasADAlarms ( )

Queries to see if this A/D measuring device has high/low alarms.

Returns:
true if has high/low trips

Implements ADContainer.

boolean hasSelectableTemperatureResolution ( )

Queries to see if this device has selectable temperature resolution.

Returns:
true if has selectable temperature resolution

Implements TemperatureContainer.

boolean hasTemperatureAlarms ( )

Queries to see if this temperature measuring device has high/low trip alarms.

Returns:
true if has high/low temperature trip alarms

Implements TemperatureContainer.

void lockBlock ( int  blockNumber) throws OneWireIOException, OneWireException

Permanently write-protects one of the user blocks of EEPROM.

Parameters:
blockNumberblock number to permanently write protect, acceptable parameters are 0 and 1.
Exceptions:
OneWireIOExceptionError locking block
OneWireExceptionCould not find part
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:
memAddrthe address to read (0-255)
Returns:
data read from memory
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
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:
memAddrthe address to read (0-255)
bufferbuffer to receive data
startstart position within buffer to place data
lenlength of buffer
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
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 the writeDevice() 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.

Returns:
1-Wire device state
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find device

Implements OneWireSensor.

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:
blockNumberthe EEPROM block number to read, acceptable parameters are 0 and 1
Returns:
16 data bytes
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
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 the readDevice() method. The method writeDevice() must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
alarmTypedesired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
alarmA/D alarm value (will be reduced to 8 bit resolution)
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireExceptionDevice does not support A/D alarms

Implements ADContainer.

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 the readDevice() method. The method writeDevice() must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
alarmTypedesired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
alarmEnableA/D alarm enable value
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireExceptionDevice does not support A/D alarms

Implements ADContainer.

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 the readDevice() method. The method writeDevice() must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
rangemax A/D volt range, use getRanges() method to get available ranges
statecurrent state of the device returned from readDevice()

Implements ADContainer.

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 the readDevice() method. The method writeDevice() must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().

Parameters:
channelchannel in the range [0 to (getNumberChannels() - 1)]
resolutionA/D resolution in volts
statecurrent state of the device returned from readDevice()

Implements ADContainer.

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 and SPECIAL_FEATURE_REGISTER.

Parameters:
memAddrregister address, these addresses are predefined above
flagToSetbitmask of flag to set, valid parameters pertaining to each register are defined as constant fields above
flagValuevalue to set the flag to
Exceptions:
OneWireIOExceptionError setting flag
OneWireExceptionCould not find part
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:
onstate of the PIO pin to set
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionCould not find part
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:
remainingCapacityremaining capacity in mAH
Exceptions:
OneWireIOExceptionError reading data
OneWireExceptionCould not find part
synchronized 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:
Rsensresistance in ohms
synchronized 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.

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 method writeDevice() with this data to finalize the change to the device.

Parameters:
alarmTypetrip type ALARM_HIGH (1) or ALARM_LOW (0)
alarmValuehigh/low temperature trip value in degrees C
statedevice state
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionDevice does not support temperature alarms

Implements TemperatureContainer.

void setTemperatureResolution ( double  resolution,
byte[]  state 
) throws OneWireException, OneWireIOException

Sets the current temperature resolution in degrees C in the provided state data.

Use the method writeDevice() with this data to finalize the change to the device.

Parameters:
resolutiontemperature resolution in degrees C
statedevice state
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionCould not find device

Implements TemperatureContainer.

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:
memAddraddress to write (0-255)
datadata byte to write to memory
Exceptions:
OneWireIOExceptionError writing data
OneWireExceptionCould not find part
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.

Parameters:
statedevice state
Exceptions:
OneWireIOExceptionError writting data
OneWireExceptionCould not find device

Implements OneWireSensor.

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 with lockBlock(). This method performs error checking by verifying data written.

Parameters:
blockNumberblock to write, acceptable parameters are 0 and 1
data16 bytes of data to write
Exceptions:
OneWireIOExceptionError writing data
OneWireExceptionCould not find part

Member Data Documentation

final byte CC_PIN_STATE_FLAG = 8 [static]

PROTECTION REGISTER FLAG: Mirrors the !CC output pin.

Accessed with getFlag()

final byte CHARGE_ENABLE_FLAG = 2 [static]

PROTECTION REGISTER FLAG: Reseting this flag will disable charging regardless of cell or pack conditions.

Accessed with getFlag()/setFlag().

final byte CHARGE_OVERCURRENT_FLAG = 32 [static]

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()

final byte DC_PIN_STATE_FLAG = 4 [static]

PROTECTION REGISTER FLAG: Mirrors the !DC output pin.

Accessed with getFlag()

final byte DISCHARGE_ENABLE_FLAG = 1 [static]

PROTECTION REGISTER FLAG: Reseting this flag will disable discharging.

Accessed with getFlag()/setFlag().

final byte DISCHARGE_OVERCURRENT_FLAG = 16 [static]

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()

final byte EEPROM_BLOCK_0_LOCK_FLAG = 1 [static]

EEPROM REGISTER FLAG: When this flag is true, Block 0 of the EEPROM (addresses 32-47) is read-only.

Accessed with getFlag().

final byte EEPROM_BLOCK_1_LOCK_FLAG = 2 [static]

EEPROM REGISTER FLAG: When this flag is true, Block 1 of the EEPROM (addresses 48-63) is read-only.

Accessed with getFlag().

final byte EEPROM_COPY_FLAG = ( byte ) 128 [static]

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().

final byte EEPROM_LOCK_ENABLE_FLAG = 64 [static]

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().

final byte EEPROM_REGISTER = 7 [static]

Address of the EEPROM Register.

Used to set/check flags with setFlag()/getFlag().

final byte OVERVOLTAGE_FLAG = ( byte ) 128 [static]

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().

final byte PIO_PIN_SENSE_AND_CONTROL_FLAG = 64 [static]

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().

final byte PROTECTION_REGISTER = 0 [static]

Address of the Protection Register.

Used to set/check flags with setFlag()/getFlag().

final byte PS_PIN_STATE_FLAG = ( byte ) 128 [static]

SPECIAL FEATURE REGISTER FLAG: Mirrors the state of the !PS pin.

Accessed with getFlag().

final byte READ_NET_ADDRESS_OPCODE_FLAG = 16 [static]

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().

final byte SLEEP_MODE_ENABLE_FLAG = 32 [static]

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().

final byte SPECIAL_FEATURE_REGISTER = 8 [static]

Address of the Special Feature Register (SFR).

Used to check flags with getFlag().

final byte STATUS_REGISTER = 1 [static]

Address of the Status Register.

Used to set/check flags with setFlag()/getFlag().

final byte UNDERVOLTAGE_FLAG = 64 [static]

PROTECTION REGISTER FLAG: When this flag is true, the battery pack has experienced an undervoltage.

This flag must be reset! Accessed with getFlag()


The documentation for this class was generated from the following file: