Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

LTC2991: 14-bit ADC octal I2C voltage, current, and temperature monitor. More...

Detailed Description

LTC2991: 14-bit ADC octal I2C voltage, current, and temperature monitor.

The LTC2991 is used to monitor system temperatures, voltages and currents.
Through the I2C serial interface, the eight monitors can individually measure
supply voltages and can be paired for differential measurements of current sense
resistors or temperature sensing transistors. Additional measurements include
internal temperature and internal VCC. The internal 10ppm reference minimizes
the number of supporting components and area required. Selectable address and
configurable functionality give the LTC2991 flexibility to be incorporated in
various systems needing temperature, voltage or current data. The LTC2991 fits
well in systems needing submillivolt voltage resolution, 1% current measurement
and 1 degree Celsius temperature accuracy or any combination of the three.

I2C DATA FORMAT (MSB FIRST);

Data Out:
Byte #1                                     Byte #2                    Byte #3

START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK   X X X X C3 C2 C1 C0 SACK   D7 D6 D5 D4 D3 D2 D1 D0 SACK STOP

Data In:
Byte #1                                     Byte #2                                  Byte #3

START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK   X X X X C3 C2 C1 C0 SACK   REPEAT START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK

Byte #4                              Byte #5
MSB                                  LSB
D15 D14 D13 D12 D11 D10 D9 D8 MACK   D7 D6 D5 D4 D3 D2 D1 D0 MNACK STOP

START        : I2C Start
REPEAT Start : I2C Repeat Start
STOP         : I2C Stop
SACK         : I2C Slave Generated Acknowledge (Active Low)
MACK         : I2C Master Generated Acknowledge (Active Low)
MNACK        : I2C Master Generated Not Acknowledge
SAx  : I2C Address
W    : I2C Write (0)
R    : I2C Read  (1)
Cx   : Command Code
Dx   : Data Bits
X    : Don't care


Example Code:

Read single-ended voltage from V1.

    // Enable Single-Ended Mode
    ack |= LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, 0x00, LTC2991_V1_V2_DIFFERENTIAL_ENABLE | LTC2991_V1_V2_TEMP_ENABLE);

    // Flush one ADC reading in case it is stale.  Then, take a new fresh reading.
    ack |= LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V1_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);

    voltage = LTC2991_code_to_single_ended_voltage(code, LTC2991_SINGLE_ENDED_lsb); // Converts code to voltage from single-ended lsb

Read current from V3-V4.

    resistor = 1; // R_sense across V3-V4 in ohms

    // Enable Differential Mode
    ack |= LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, LTC2991_V3_V4_DIFFERENTIAL_ENABLE, LTC2991_V3_V4_TEMP_ENABLE);

    // Flush one ADC reading in case it is stale.  Then, take a new fresh reading.
    ack |= LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V4_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);

    voltage = LTC2991_code_to_differential_voltage(code, LTC2991_DIFFERENTIAL_lsb); // Converts code to voltage from differential lsb
    current = voltage / resistor; // Calculates current

Read temperature from diode connected to V7-V8.

    // Enable temperature mode.
    ack |= LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V5678_REG, LTC2991_V7_V8_TEMP_ENABLE, 0x00);

    // Flush one ADC reading in case it is stale.  Then, take a new fresh reading.
    ack |= LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V7_MSB_REG, &adc_code, &data_valid, LTC2991_TIMEOUT);

    // Converts code to temperature from adc code and temperature lsb
    temperature = LTC2991_temperature(adc_code, LTC2991_TEMPERATURE_lsb);

http://www.linear.com/product/LTC2991

http://www.linear.com/product/LTC2991#demoboards

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  • The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
  • Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Library Header File for LTC2991: 14-bit Octal I2C Voltage, Current, and Temperature Monitor

Definition in file LTC2991.h.

Go to the source code of this file.

Functions

int8_t LTC2991_adc_read (uint8_t i2c_address, uint8_t msb_register_address, int16_t *adc_code, int8_t *data_valid)
 Reads a 14-bit adc_code from LTC2991. More...
 
int8_t LTC2991_adc_read_timeout (uint8_t i2c_address, uint8_t msb_register_address, int16_t *adc_code, int8_t *data_valid, uint16_t timeout, uint8_t status_bit)
 Reads a 14-bit adc_code from the LTC2991 but enforces a maximum timeout. More...
 
int8_t LTC2991_adc_read_new_data (uint8_t i2c_address, uint8_t msb_register_address, int16_t *adc_code, int8_t *data_valid, uint16_t timeout)
 Reads new data (even after a mode change) by flushing old data and waiting for the data_valid bit to be set. More...
 
int8_t LTC2991_register_read (uint8_t i2c_address, uint8_t register_address, uint8_t *register_data)
 Reads an 8-bit register from the LTC2991 using the standard repeated start format. More...
 
int8_t LTC2991_register_write (uint8_t i2c_address, uint8_t register_address, uint8_t register_data)
 Write one byte to an LTC2991 register. More...
 
int8_t LTC2991_register_set_clear_bits (uint8_t i2c_address, uint8_t register_address, uint8_t bits_to_set, uint8_t bits_to_clear)
 Used to set and clear bits in a control register. More...
 
float LTC2991_code_to_single_ended_voltage (int16_t adc_code, float LTC2991_single_ended_lsb)
 Calculates the LTC2991 single-ended input voltages. More...
 
float LTC2991_code_to_vcc_voltage (int16_t adc_code, float LTC2991_single_ended_lsb)
 Calculates the LTC2991 Vcc voltage. More...
 
float LTC2991_code_to_differential_voltage (int16_t adc_code, float LTC2991_differential_lsb)
 Calculates the LTC2991 differential input voltage. More...
 
float LTC2991_temperature (int16_t adc_code, float LTC2991_temperature_lsb, boolean unit)
 Calculates the LTC2991 temperature. More...
 
float LTC2991_code_to_diode_voltage (int16_t adc_code, float LTC2991_diode_voltage_lsb)
 Calcultates the LTC2991 diode voltage. More...
 

Macros

I2C_Addresses
#define LTC2991_I2C_ADDRESS   0x48
 I2C address of the LTC2991. More...
 
#define LTC2991_I2C_GLOBAL_ADDRESS   0x77
 LTC2991 Global I2C Address. More...
 
REGISTERS
#define LTC2991_STATUS_LOW_REG   0x00
 Data_Valid Bits(V1 Through V8) More...
 
#define LTC2991_STATUS_HIGH_REG   0x01
 Data_valid bits. More...
 
#define LTC2991_CHANNEL_ENABLE_REG   0x01
 Channel Enable, Vcc, T_internal Conversion Status, Trigger. More...
 
#define LTC2991_CONTROL_V1234_REG   0x06
 V1, V2, V3, and V4 Control Register. More...
 
#define LTC2991_CONTROL_V5678_REG   0x07
 V5, V6, V7, AND V8 Control Register. More...
 
#define LTC2991_CONTROL_PWM_Tinternal_REG   0x08
 PWM Threshold and T_internal Control Register. More...
 
#define LTC2991_PWM_THRESHOLD_MSB_REG   0x09
 PWM Threshold. More...
 
#define LTC2991_V1_MSB_REG   0x0A
 V1, or T_R1 T MSB. More...
 
#define LTC2991_V1_LSB_REG   0x0B
 V1, or T_R1 T LSB. More...
 
#define LTC2991_V2_MSB_REG   0x0C
 V2, V1-V2, or T_R2 Voltage MSB. More...
 
#define LTC2991_V2_LSB_REG   0x0D
 V2, V1-V2, or T_R2 Voltage LSB. More...
 
#define LTC2991_V3_MSB_REG   0x0E
 V3, or T_R2 T MSB. More...
 
#define LTC2991_V3_LSB_REG   0x0F
 V3, or T_R2 T LSB. More...
 
#define LTC2991_V4_MSB_REG   0x10
 V4, V3-V4, or T_R2 Voltage MSB. More...
 
#define LTC2991_V4_LSB_REG   0x11
 V4, V3-V4, or T_R2 Voltage LSB. More...
 
#define LTC2991_V5_MSB_REG   0x12
 V5, or T_R3 T MSB. More...
 
#define LTC2991_V5_LSB_REG   0x13
 V5, or T_R3 T LSB. More...
 
#define LTC2991_V6_MSB_REG   0x14
 V6, V5-V6, or T_R3 Voltage MSB. More...
 
#define LTC2991_V6_LSB_REG   0x15
 V6, V5-V6, or T_R3 Voltage LSB. More...
 
#define LTC2991_V7_MSB_REG   0x16
 V7, or T_R4 T MSB. More...
 
#define LTC2991_V7_LSB_REG   0x17
 V7, or T_R4 T LSB. More...
 
#define LTC2991_V8_MSB_REG   0x18
 V8, V7-V8, or T_R4 Voltage MSB. More...
 
#define LTC2991_V8_LSB_REG   0x19
 V8, V7-V8, or T_R4 Voltage LSB. More...
 
#define LTC2991_T_Internal_MSB_REG   0x1A
 T_Internal MSB. More...
 
#define LTC2991_T_Internal_LSB_REG   0x1B
 T_Internal LSB. More...
 
#define LTC2991_Vcc_MSB_REG   0x1C
 Vcc MSB. More...
 
#define LTC2991_Vcc_LSB_REG   0x1D
 Vcc LSB. More...
 
LTC2991_CHANNEL_ENABLE_REG SETTINGS

Bitwise OR settings, and write to LTC2991_CHANNEL_ENABLE_REG to configure settings.

Bitwise AND with value read from LTC2991_CHANNEL_ENABLE_REG to determine present setting.

#define LTC2991_V7_V8_TR4_ENABLE   0x80
 Enable V7-V8 measurements, including TR4 temperature. More...
 
#define LTC2991_V5_V6_TR3_ENABLE   0x40
 Enable V5-V6 measurements, including TR3 temperature. More...
 
#define LTC2991_V3_V4_TR2_ENABLE   0x20
 Enable V3-V4 measurements, including TR2 temperature. More...
 
#define LTC2991_V1_V2_TR1_ENABLE   0x10
 Enable V1-V2 measurements, including TR1 temperature. More...
 
#define LTC2991_VCC_TINTERNAL_ENABLE   0x08
 Enable Vcc internal voltage measurement. More...
 
#define LTC2991_ENABLE_ALL_CHANNELS   0xF8
 Use to enable all LTC2991 channels. More...
 
#define LTC2991_BUSY   0x04
 LTC2991 Busy Bit. More...
 
LTC2991_CONTROL_V1234_REG SETTINGS

Bitwise OR settings, and write to LTC2991_CONTROL_V1234_REG to configure settings.

Bitwise AND with value read from LTC2991_CONTROL_V1234_REG to determine present setting.

#define LTC2991_V3_V4_FILTER_ENABLE   0x80
 Enable filters on V3-V4. More...
 
#define LTC2991_V3_V4_KELVIN_ENABLE   0x40
 Enable V3-V4 for Kelvin. More...
 
#define LTC2991_V3_V4_TEMP_ENABLE   0x20
 Enable V3-V4 temperature mode. More...
 
#define LTC2991_V3_V4_DIFFERENTIAL_ENABLE   0x10
 Enable V3-V4 differential mode. More...
 
#define LTC2991_V1_V2_FILTER_ENABLE   0x08
 Enable filters on V1-V2. More...
 
#define LTC2991_V1_V2_KELVIN_ENABLE   0x04
 Enable V1-V2 for Kelvin. More...
 
#define LTC2991_V1_V2_TEMP_ENABLE   0x02
 Enable V1-V2 temperature mode. More...
 
#define LTC2991_V1_V2_DIFFERENTIAL_ENABLE   0x01
 Enable V1-V2 differential mode. More...
 
LTC2991_CONTROL_V5678_REG SETTINGS

Bitwise OR settings, and write to LTC2991_CONTROL_V5678_REG to configure settings.

Bitwise AND with value read from LTC2991_CONTROL_V5678_REG to determine present setting.

#define LTC2991_V7_V8_FILTER_ENABLE   0x80
 Enable filters on V7-V8. More...
 
#define LTC2991_V7_V8_KELVIN_ENABLE   0x40
 Enable V7-V8 for Kelvin. More...
 
#define LTC2991_V7_V8_TEMP_ENABLE   0x20
 Enable V7-V8 temperature mode. More...
 
#define LTC2991_V7_V8_DIFFERENTIAL_ENABLE   0x10
 Enable V7-V8 differential mode. More...
 
#define LTC2991_V5_V6_FILTER_ENABLE   0x08
 Enable filters on V5-V6. More...
 
#define LTC2991_V5_V6_KELVIN_ENABLE   0x04
 Enable V5-V6 for Kelvin. More...
 
#define LTC2991_V5_V6_TEMP_ENABLE   0x02
 Enable V5-V6 temperature mode. More...
 
#define LTC2991_V5_V6_DIFFERENTIAL_ENABLE   0x01
 Enable V5-V6 differential mode. More...
 
LTC2991_CONTROL_PWM_Tinternal_REG SETTINGS

Bitwise OR settings, and write to LTC2991_CONTROL_PWM_Tinternal_REG to configure settings.

Bitwise AND with value read from LTC2991_CONTROL_PWM_Tinternal_REG to determine present setting.

#define LTC2991_PWM_0   0x80
 PWM threshold Least Significant Bit. More...
 
#define LTC2991_PWM_INVERT   0x40
 Invert PWM. More...
 
#define LTC2991_PWM_ENABLE   0x20
 Enable PWM. More...
 
#define LTC2991_REPEAT_MODE   0x10
 Enable Repeated Aquisition Mode. More...
 
#define LTC2991_INT_FILTER_ENABLE   0x08
 Enable Internal Temperature Filter. More...
 
#define LTC2991_INT_KELVIN_ENABLE   0x04
 Enable internal temperature for Kelvin. More...
 

Variables

const float LTC2991_SINGLE_ENDED_lsb = 3.05176E-04
 Typical single-ended LSB weight in volts. More...
 
const float LTC2991_DIFFERENTIAL_lsb = 1.90735E-05
 Typical differential LSB weight in volts. More...
 
const float LTC2991_VCC_lsb = 3.05176E-04
 Typical VCC LSB weight in volts. More...
 
const float LTC2991_TEMPERATURE_lsb = 0.0625
 Typical temperature LSB weight in degrees Celsius (and Kelvin). More...
 
const float LTC2991_DIODE_VOLTAGE_lsb = 3.815E-05
 Typical remote diode LSB weight in volts. More...
 

Function Documentation

◆ LTC2991_adc_read()

int8_t LTC2991_adc_read ( uint8_t  i2c_address,
uint8_t  msb_register_address,
int16_t *  adc_code,
int8_t *  data_valid 
)

Reads a 14-bit adc_code from LTC2991.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
msb_register_addressAddress of the LTC2991 MSB register to be read. This is also known as the "command byte". Two sequential 8-bit registers are read, starting with the msb_register_address.
adc_codereturns 14-bit value read from the adc
data_validreturns the status of the DATA_VALID bit. *data_valid=0 indicates stale data

Definition at line 76 of file LTC2991.cpp.

◆ LTC2991_adc_read_new_data()

int8_t LTC2991_adc_read_new_data ( uint8_t  i2c_address,
uint8_t  msb_register_address,
int16_t *  adc_code,
int8_t *  data_valid,
uint16_t  timeout 
)

Reads new data (even after a mode change) by flushing old data and waiting for the data_valid bit to be set.

This function simplifies adc reads when modes are changing. For example, if V1-V2 changes from temperature mode to differential voltage mode, the data in the register may still correspond to the temperature reading immediately after the mode change. Flushing one reading and waiting for a new reading guarantees fresh data is received. If the timeout is reached without valid data (*data_valid=1) the function exits.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
msb_register_addressAddress of the LTC2991 MSB register to be read. This is also known as the "command byte". Two sequential 8-bit registers will be read, starting with the msb_register_address.
adc_codereturns 14-bit value read from the adc
data_validreturns the status of the DATA_VALID bit. *data_valid=0 indicates stale data
timeoutmaximum timeout in millisceonds. If at any time a NACK is received the function aborts. If the timeout is reached without valid data (*data_valid=1) the function exits.

Definition at line 142 of file LTC2991.cpp.

◆ LTC2991_adc_read_timeout()

int8_t LTC2991_adc_read_timeout ( uint8_t  i2c_address,
uint8_t  msb_register_address,
int16_t *  adc_code,
int8_t *  data_valid,
uint16_t  timeout,
uint8_t  status_bit 
)

Reads a 14-bit adc_code from the LTC2991 but enforces a maximum timeout.

Similar to LTC2991_adc_read except it repeats until the data_valid bit is set, it fails to receive an I2C acknowledge, or the timeout (in milliseconds) expires. It keeps trying to read from the LTC2991 every millisecond until the data_valid bit is set (indicating new data since the previous time this register was read) or until it fails to receive an I2C acknowledge (indicating an error on the I2C bus).

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
msb_register_addressAddress of the LTC2991 MSB register to be read. This is also known as the "command byte". Two sequential 8-bit registers will be read, starting with the msb_register_address.
adc_codereturns 14-bit value read from the adc
data_validreturns the status of the DATA_VALID bit. *data_valid=0 indicates stale data
timeoutmaximum timeout in millisceonds. If at any time a NACK is received the function aborts.
status_bitIf the timeout is reached without valid data (data_valid=1) the function exits./

Definition at line 93 of file LTC2991.cpp.

◆ LTC2991_code_to_differential_voltage()

float LTC2991_code_to_differential_voltage ( int16_t  adc_code,
float  LTC2991_differential_lsb 
)

Calculates the LTC2991 differential input voltage.

Returns
the differential voltage in volts
Parameters
adc_codecode read from the adc (from a function such as LTC2991_adc_read)
LTC2991_differential_lsbdifferential LSB weight. If not calibrated, use LTC2991_DIFFERENTIAL_LSB

Definition at line 216 of file LTC2991.cpp.

◆ LTC2991_code_to_diode_voltage()

float LTC2991_code_to_diode_voltage ( int16_t  adc_code,
float  LTC2991_diode_voltage_lsb 
)

Calcultates the LTC2991 diode voltage.

Returns
the diode voltage in volts.
Parameters
adc_codecode read from the adc (from a function such as LTC2991_adc_read)
LTC2991_diode_voltage_lsbdiode voltage LSB weight. If not calibrated, use LTC2991_DIODE_VOLTAGE_LSB

Definition at line 247 of file LTC2991.cpp.

◆ LTC2991_code_to_single_ended_voltage()

float LTC2991_code_to_single_ended_voltage ( int16_t  adc_code,
float  LTC2991_single_ended_lsb 
)

Calculates the LTC2991 single-ended input voltages.

Returns
the single-ended voCalculatesltage in volts
Parameters
adc_codecode read from the adc (from a function such as LTC2991_adc_read)
LTC2991_single_ended_lsbsingle-ended LSB weight. If not calibrated, use LTC2991_SINGLE_ENDED_LSB

Definition at line 186 of file LTC2991.cpp.

◆ LTC2991_code_to_vcc_voltage()

float LTC2991_code_to_vcc_voltage ( int16_t  adc_code,
float  LTC2991_single_ended_lsb 
)

Calculates the LTC2991 Vcc voltage.

Returns
the Vcc voltage in volts
Parameters
adc_codecode read from the adc (from a function such as LTC2991_adc_read)
LTC2991_single_ended_lsbVcc LSB weight. If not calibrated, use LTC2991_VCC_LSB

Definition at line 201 of file LTC2991.cpp.

◆ LTC2991_register_read()

int8_t LTC2991_register_read ( uint8_t  i2c_address,
uint8_t  register_address,
uint8_t *  register_data 
)

Reads an 8-bit register from the LTC2991 using the standard repeated start format.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
register_addressAddress of the LTC2991 register to be read. This is also known as the "command byte".
register_datareturns 8-bit value read from the LTC2991 register.

Definition at line 153 of file LTC2991.cpp.

◆ LTC2991_register_set_clear_bits()

int8_t LTC2991_register_set_clear_bits ( uint8_t  i2c_address,
uint8_t  register_address,
uint8_t  bits_to_set,
uint8_t  bits_to_clear 
)

Used to set and clear bits in a control register.

bits_to_set will be bitwise OR'd with the register. bits_to_clear will be inverted and bitwise AND'd with the register so that every location with a 1 will result in a 0 in the register.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
register_addressAddress of the LTC2991 register to be modified.
bits_to_setbits_to_set will be bitwise OR'd with the register.
bits_to_clearbits_to_clear will be inverted and bitwise AND'd with the register

Definition at line 173 of file LTC2991.cpp.

◆ LTC2991_register_write()

int8_t LTC2991_register_write ( uint8_t  i2c_address,
uint8_t  register_address,
uint8_t  register_data 
)

Write one byte to an LTC2991 register.

Writes to an 8-bit register inside the LTC2991 using the standard I2C repeated start format.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
register_addressAddress of the LTC2991 register to be overwritten. This is also known as the "command byte".
register_dataValue that will be written to the register.

Definition at line 163 of file LTC2991.cpp.

◆ LTC2991_temperature()

float LTC2991_temperature ( int16_t  adc_code,
float  LTC2991_temperature_lsb,
boolean  unit 
)

Calculates the LTC2991 temperature.

Returns
the temperature in degrees Celsius or degrees Kevlin (dependent on mode setting).
Parameters
adc_codecode read from the adc (from a function such as LTC2991_adc_read).
LTC2991_temperature_lsbtemperature LSB weight. If not calibrated, use LTC2991_TEMPERATURE_LSB
unitThe temperature unit, true for Kelvin, false for Celsius

Definition at line 230 of file LTC2991.cpp.

Macro Definition Documentation

◆ LTC2991_BUSY

#define LTC2991_BUSY   0x04

LTC2991 Busy Bit.

Definition at line 212 of file LTC2991.h.

◆ LTC2991_CHANNEL_ENABLE_REG

#define LTC2991_CHANNEL_ENABLE_REG   0x01

Channel Enable, Vcc, T_internal Conversion Status, Trigger.

Definition at line 174 of file LTC2991.h.

◆ LTC2991_CONTROL_PWM_Tinternal_REG

#define LTC2991_CONTROL_PWM_Tinternal_REG   0x08

PWM Threshold and T_internal Control Register.

Definition at line 177 of file LTC2991.h.

◆ LTC2991_CONTROL_V1234_REG

#define LTC2991_CONTROL_V1234_REG   0x06

V1, V2, V3, and V4 Control Register.

Definition at line 175 of file LTC2991.h.

◆ LTC2991_CONTROL_V5678_REG

#define LTC2991_CONTROL_V5678_REG   0x07

V5, V6, V7, AND V8 Control Register.

Definition at line 176 of file LTC2991.h.

◆ LTC2991_ENABLE_ALL_CHANNELS

#define LTC2991_ENABLE_ALL_CHANNELS   0xF8

Use to enable all LTC2991 channels.

Equivalent to bitwise OR'ing all channel enables.

Definition at line 211 of file LTC2991.h.

◆ LTC2991_I2C_ADDRESS

#define LTC2991_I2C_ADDRESS   0x48

I2C address of the LTC2991.

Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet. Uncomment LTC2991_I2C_ADDRESS to match demo board configuration.

Definition at line 156 of file LTC2991.h.

◆ LTC2991_I2C_GLOBAL_ADDRESS

#define LTC2991_I2C_GLOBAL_ADDRESS   0x77

LTC2991 Global I2C Address.

Definition at line 166 of file LTC2991.h.

◆ LTC2991_INT_FILTER_ENABLE

#define LTC2991_INT_FILTER_ENABLE   0x08

Enable Internal Temperature Filter.

Definition at line 254 of file LTC2991.h.

◆ LTC2991_INT_KELVIN_ENABLE

#define LTC2991_INT_KELVIN_ENABLE   0x04

Enable internal temperature for Kelvin.

Otherwise, Celsius.

Definition at line 255 of file LTC2991.h.

◆ LTC2991_PWM_0

#define LTC2991_PWM_0   0x80

PWM threshold Least Significant Bit.

Definition at line 250 of file LTC2991.h.

◆ LTC2991_PWM_ENABLE

#define LTC2991_PWM_ENABLE   0x20

Enable PWM.

Definition at line 252 of file LTC2991.h.

◆ LTC2991_PWM_INVERT

#define LTC2991_PWM_INVERT   0x40

Invert PWM.

Definition at line 251 of file LTC2991.h.

◆ LTC2991_PWM_THRESHOLD_MSB_REG

#define LTC2991_PWM_THRESHOLD_MSB_REG   0x09

PWM Threshold.

Definition at line 178 of file LTC2991.h.

◆ LTC2991_REPEAT_MODE

#define LTC2991_REPEAT_MODE   0x10

Enable Repeated Aquisition Mode.

Definition at line 253 of file LTC2991.h.

◆ LTC2991_STATUS_HIGH_REG

#define LTC2991_STATUS_HIGH_REG   0x01

Data_valid bits.

Definition at line 173 of file LTC2991.h.

◆ LTC2991_STATUS_LOW_REG

#define LTC2991_STATUS_LOW_REG   0x00

Data_Valid Bits(V1 Through V8)

Definition at line 172 of file LTC2991.h.

◆ LTC2991_T_Internal_LSB_REG

#define LTC2991_T_Internal_LSB_REG   0x1B

T_Internal LSB.

Definition at line 196 of file LTC2991.h.

◆ LTC2991_T_Internal_MSB_REG

#define LTC2991_T_Internal_MSB_REG   0x1A

T_Internal MSB.

Definition at line 195 of file LTC2991.h.

◆ LTC2991_V1_LSB_REG

#define LTC2991_V1_LSB_REG   0x0B

V1, or T_R1 T LSB.

Definition at line 180 of file LTC2991.h.

◆ LTC2991_V1_MSB_REG

#define LTC2991_V1_MSB_REG   0x0A

V1, or T_R1 T MSB.

Definition at line 179 of file LTC2991.h.

◆ LTC2991_V1_V2_DIFFERENTIAL_ENABLE

#define LTC2991_V1_V2_DIFFERENTIAL_ENABLE   0x01

Enable V1-V2 differential mode.

Otherwise, single-ended.

Definition at line 227 of file LTC2991.h.

◆ LTC2991_V1_V2_FILTER_ENABLE

#define LTC2991_V1_V2_FILTER_ENABLE   0x08

Enable filters on V1-V2.

Definition at line 224 of file LTC2991.h.

◆ LTC2991_V1_V2_KELVIN_ENABLE

#define LTC2991_V1_V2_KELVIN_ENABLE   0x04

Enable V1-V2 for Kelvin.

Otherwise, Celsius.

Definition at line 225 of file LTC2991.h.

◆ LTC2991_V1_V2_TEMP_ENABLE

#define LTC2991_V1_V2_TEMP_ENABLE   0x02

Enable V1-V2 temperature mode.

Definition at line 226 of file LTC2991.h.

◆ LTC2991_V1_V2_TR1_ENABLE

#define LTC2991_V1_V2_TR1_ENABLE   0x10

Enable V1-V2 measurements, including TR1 temperature.

Definition at line 209 of file LTC2991.h.

◆ LTC2991_V2_LSB_REG

#define LTC2991_V2_LSB_REG   0x0D

V2, V1-V2, or T_R2 Voltage LSB.

Definition at line 182 of file LTC2991.h.

◆ LTC2991_V2_MSB_REG

#define LTC2991_V2_MSB_REG   0x0C

V2, V1-V2, or T_R2 Voltage MSB.

Definition at line 181 of file LTC2991.h.

◆ LTC2991_V3_LSB_REG

#define LTC2991_V3_LSB_REG   0x0F

V3, or T_R2 T LSB.

Definition at line 184 of file LTC2991.h.

◆ LTC2991_V3_MSB_REG

#define LTC2991_V3_MSB_REG   0x0E

V3, or T_R2 T MSB.

Definition at line 183 of file LTC2991.h.

◆ LTC2991_V3_V4_DIFFERENTIAL_ENABLE

#define LTC2991_V3_V4_DIFFERENTIAL_ENABLE   0x10

Enable V3-V4 differential mode.

Otherwise, single-ended.

Definition at line 223 of file LTC2991.h.

◆ LTC2991_V3_V4_FILTER_ENABLE

#define LTC2991_V3_V4_FILTER_ENABLE   0x80

Enable filters on V3-V4.

Definition at line 220 of file LTC2991.h.

◆ LTC2991_V3_V4_KELVIN_ENABLE

#define LTC2991_V3_V4_KELVIN_ENABLE   0x40

Enable V3-V4 for Kelvin.

Otherwise, Celsius.

Definition at line 221 of file LTC2991.h.

◆ LTC2991_V3_V4_TEMP_ENABLE

#define LTC2991_V3_V4_TEMP_ENABLE   0x20

Enable V3-V4 temperature mode.

Definition at line 222 of file LTC2991.h.

◆ LTC2991_V3_V4_TR2_ENABLE

#define LTC2991_V3_V4_TR2_ENABLE   0x20

Enable V3-V4 measurements, including TR2 temperature.

Definition at line 208 of file LTC2991.h.

◆ LTC2991_V4_LSB_REG

#define LTC2991_V4_LSB_REG   0x11

V4, V3-V4, or T_R2 Voltage LSB.

Definition at line 186 of file LTC2991.h.

◆ LTC2991_V4_MSB_REG

#define LTC2991_V4_MSB_REG   0x10

V4, V3-V4, or T_R2 Voltage MSB.

Definition at line 185 of file LTC2991.h.

◆ LTC2991_V5_LSB_REG

#define LTC2991_V5_LSB_REG   0x13

V5, or T_R3 T LSB.

Definition at line 188 of file LTC2991.h.

◆ LTC2991_V5_MSB_REG

#define LTC2991_V5_MSB_REG   0x12

V5, or T_R3 T MSB.

Definition at line 187 of file LTC2991.h.

◆ LTC2991_V5_V6_DIFFERENTIAL_ENABLE

#define LTC2991_V5_V6_DIFFERENTIAL_ENABLE   0x01

Enable V5-V6 differential mode.

Otherwise, single-ended.

Definition at line 242 of file LTC2991.h.

◆ LTC2991_V5_V6_FILTER_ENABLE

#define LTC2991_V5_V6_FILTER_ENABLE   0x08

Enable filters on V5-V6.

Definition at line 239 of file LTC2991.h.

◆ LTC2991_V5_V6_KELVIN_ENABLE

#define LTC2991_V5_V6_KELVIN_ENABLE   0x04

Enable V5-V6 for Kelvin.

Otherwise, Celsius.

Definition at line 240 of file LTC2991.h.

◆ LTC2991_V5_V6_TEMP_ENABLE

#define LTC2991_V5_V6_TEMP_ENABLE   0x02

Enable V5-V6 temperature mode.

Definition at line 241 of file LTC2991.h.

◆ LTC2991_V5_V6_TR3_ENABLE

#define LTC2991_V5_V6_TR3_ENABLE   0x40

Enable V5-V6 measurements, including TR3 temperature.

Definition at line 207 of file LTC2991.h.

◆ LTC2991_V6_LSB_REG

#define LTC2991_V6_LSB_REG   0x15

V6, V5-V6, or T_R3 Voltage LSB.

Definition at line 190 of file LTC2991.h.

◆ LTC2991_V6_MSB_REG

#define LTC2991_V6_MSB_REG   0x14

V6, V5-V6, or T_R3 Voltage MSB.

Definition at line 189 of file LTC2991.h.

◆ LTC2991_V7_LSB_REG

#define LTC2991_V7_LSB_REG   0x17

V7, or T_R4 T LSB.

Definition at line 192 of file LTC2991.h.

◆ LTC2991_V7_MSB_REG

#define LTC2991_V7_MSB_REG   0x16

V7, or T_R4 T MSB.

Definition at line 191 of file LTC2991.h.

◆ LTC2991_V7_V8_DIFFERENTIAL_ENABLE

#define LTC2991_V7_V8_DIFFERENTIAL_ENABLE   0x10

Enable V7-V8 differential mode.

Otherwise, single-ended.

Definition at line 238 of file LTC2991.h.

◆ LTC2991_V7_V8_FILTER_ENABLE

#define LTC2991_V7_V8_FILTER_ENABLE   0x80

Enable filters on V7-V8.

Definition at line 235 of file LTC2991.h.

◆ LTC2991_V7_V8_KELVIN_ENABLE

#define LTC2991_V7_V8_KELVIN_ENABLE   0x40

Enable V7-V8 for Kelvin.

Otherwise, Celsius.

Definition at line 236 of file LTC2991.h.

◆ LTC2991_V7_V8_TEMP_ENABLE

#define LTC2991_V7_V8_TEMP_ENABLE   0x20

Enable V7-V8 temperature mode.

Definition at line 237 of file LTC2991.h.

◆ LTC2991_V7_V8_TR4_ENABLE

#define LTC2991_V7_V8_TR4_ENABLE   0x80

Enable V7-V8 measurements, including TR4 temperature.

Definition at line 206 of file LTC2991.h.

◆ LTC2991_V8_LSB_REG

#define LTC2991_V8_LSB_REG   0x19

V8, V7-V8, or T_R4 Voltage LSB.

Definition at line 194 of file LTC2991.h.

◆ LTC2991_V8_MSB_REG

#define LTC2991_V8_MSB_REG   0x18

V8, V7-V8, or T_R4 Voltage MSB.

Definition at line 193 of file LTC2991.h.

◆ LTC2991_Vcc_LSB_REG

#define LTC2991_Vcc_LSB_REG   0x1D

Vcc LSB.

Definition at line 198 of file LTC2991.h.

◆ LTC2991_Vcc_MSB_REG

#define LTC2991_Vcc_MSB_REG   0x1C

Vcc MSB.

Definition at line 197 of file LTC2991.h.

◆ LTC2991_VCC_TINTERNAL_ENABLE

#define LTC2991_VCC_TINTERNAL_ENABLE   0x08

Enable Vcc internal voltage measurement.

Definition at line 210 of file LTC2991.h.

Variable Documentation

◆ LTC2991_DIFFERENTIAL_lsb

const float LTC2991_DIFFERENTIAL_lsb = 1.90735E-05

Typical differential LSB weight in volts.

Definition at line 138 of file LTC2991.h.

◆ LTC2991_DIODE_VOLTAGE_lsb

const float LTC2991_DIODE_VOLTAGE_lsb = 3.815E-05

Typical remote diode LSB weight in volts.

Used to readback diode voltage when in temperature measurement mode.

Definition at line 146 of file LTC2991.h.

◆ LTC2991_SINGLE_ENDED_lsb

const float LTC2991_SINGLE_ENDED_lsb = 3.05176E-04

Typical single-ended LSB weight in volts.

Definition at line 136 of file LTC2991.h.

◆ LTC2991_TEMPERATURE_lsb

const float LTC2991_TEMPERATURE_lsb = 0.0625

Typical temperature LSB weight in degrees Celsius (and Kelvin).

Used for internal temperature as well as remote diode temperature measurements.

Definition at line 143 of file LTC2991.h.

◆ LTC2991_VCC_lsb

const float LTC2991_VCC_lsb = 3.05176E-04

Typical VCC LSB weight in volts.

Definition at line 140 of file LTC2991.h.