Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2991.h
Go to the documentation of this file.
1 /*!
2 LTC2991: 14-bit ADC octal I2C voltage, current, and temperature monitor.
3 
4 @verbatim
5 
6 The LTC2991 is used to monitor system temperatures, voltages and currents.
7 Through the I2C serial interface, the eight monitors can individually measure
8 supply voltages and can be paired for differential measurements of current sense
9 resistors or temperature sensing transistors. Additional measurements include
10 internal temperature and internal VCC. The internal 10ppm reference minimizes
11 the number of supporting components and area required. Selectable address and
12 configurable functionality give the LTC2991 flexibility to be incorporated in
13 various systems needing temperature, voltage or current data. The LTC2991 fits
14 well in systems needing submillivolt voltage resolution, 1% current measurement
15 and 1 degree Celsius temperature accuracy or any combination of the three.
16 
17 I2C DATA FORMAT (MSB FIRST);
18 
19 Data Out:
20 Byte #1 Byte #2 Byte #3
21 
22 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
23 
24 Data In:
25 Byte #1 Byte #2 Byte #3
26 
27 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
28 
29 Byte #4 Byte #5
30 MSB LSB
31 D15 D14 D13 D12 D11 D10 D9 D8 MACK D7 D6 D5 D4 D3 D2 D1 D0 MNACK STOP
32 
33 START : I2C Start
34 REPEAT Start : I2C Repeat Start
35 STOP : I2C Stop
36 SACK : I2C Slave Generated Acknowledge (Active Low)
37 MACK : I2C Master Generated Acknowledge (Active Low)
38 MNACK : I2C Master Generated Not Acknowledge
39 SAx : I2C Address
40 W : I2C Write (0)
41 R : I2C Read (1)
42 Cx : Command Code
43 Dx : Data Bits
44 X : Don't care
45 
46 
47 Example Code:
48 
49 Read single-ended voltage from V1.
50 
51  // Enable Single-Ended Mode
52  ack |= LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, 0x00, LTC2991_V1_V2_DIFFERENTIAL_ENABLE | LTC2991_V1_V2_TEMP_ENABLE);
53 
54  // Flush one ADC reading in case it is stale. Then, take a new fresh reading.
55  ack |= LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V1_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);
56 
57  voltage = LTC2991_code_to_single_ended_voltage(code, LTC2991_SINGLE_ENDED_lsb); // Converts code to voltage from single-ended lsb
58 
59 Read current from V3-V4.
60 
61  resistor = 1; // R_sense across V3-V4 in ohms
62 
63  // Enable Differential Mode
64  ack |= LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, LTC2991_V3_V4_DIFFERENTIAL_ENABLE, LTC2991_V3_V4_TEMP_ENABLE);
65 
66  // Flush one ADC reading in case it is stale. Then, take a new fresh reading.
67  ack |= LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V4_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);
68 
69  voltage = LTC2991_code_to_differential_voltage(code, LTC2991_DIFFERENTIAL_lsb); // Converts code to voltage from differential lsb
70  current = voltage / resistor; // Calculates current
71 
72 Read temperature from diode connected to V7-V8.
73 
74  // Enable temperature mode.
75  ack |= LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V5678_REG, LTC2991_V7_V8_TEMP_ENABLE, 0x00);
76 
77  // Flush one ADC reading in case it is stale. Then, take a new fresh reading.
78  ack |= LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V7_MSB_REG, &adc_code, &data_valid, LTC2991_TIMEOUT);
79 
80  // Converts code to temperature from adc code and temperature lsb
81  temperature = LTC2991_temperature(adc_code, LTC2991_TEMPERATURE_lsb);
82 
83 @endverbatim
84 
85 http://www.linear.com/product/LTC2991
86 
87 http://www.linear.com/product/LTC2991#demoboards
88 
89 
90 Copyright 2018(c) Analog Devices, Inc.
91 
92 All rights reserved.
93 
94 Redistribution and use in source and binary forms, with or without
95 modification, are permitted provided that the following conditions are met:
96  - Redistributions of source code must retain the above copyright
97  notice, this list of conditions and the following disclaimer.
98  - Redistributions in binary form must reproduce the above copyright
99  notice, this list of conditions and the following disclaimer in
100  the documentation and/or other materials provided with the
101  distribution.
102  - Neither the name of Analog Devices, Inc. nor the names of its
103  contributors may be used to endorse or promote products derived
104  from this software without specific prior written permission.
105  - The use of this software may or may not infringe the patent rights
106  of one or more patent holders. This license does not release you
107  from the requirement that you obtain separate licenses from these
108  patent holders to use this software.
109  - Use of the software either in source or binary form, must be run
110  on or directly connected to an Analog Devices Inc. component.
111 
112 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
113 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
114 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
115 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
116 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
117 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
118 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
119 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
120 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
121 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
122 
123 */
124 /*! @file
125  @ingroup LTC2991
126  Library Header File for LTC2991: 14-bit Octal I2C Voltage, Current, and Temperature Monitor
127 */
128 
129 #ifndef LTC2991_H
130 #define LTC2991_H
131 
132 #include <Wire.h>
133 
134 // Calibration Variables
135 //! Typical single-ended LSB weight in volts
136 const float LTC2991_SINGLE_ENDED_lsb = 3.05176E-04;
137 //! Typical differential LSB weight in volts
138 const float LTC2991_DIFFERENTIAL_lsb = 1.90735E-05;
139 //! Typical VCC LSB weight in volts
140 const float LTC2991_VCC_lsb = 3.05176E-04;
141 //! Typical temperature LSB weight in degrees Celsius (and Kelvin).
142 //! Used for internal temperature as well as remote diode temperature measurements.
143 const float LTC2991_TEMPERATURE_lsb = 0.0625;
144 //! Typical remote diode LSB weight in volts.
145 //! Used to readback diode voltage when in temperature measurement mode.
146 const float LTC2991_DIODE_VOLTAGE_lsb = 3.815E-05;
147 
148 /*! @name I2C_Addresses
149 @{ */
150 
151 //! I2C address of the LTC2991.
152 //! Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
153 //! Uncomment LTC2991_I2C_ADDRESS to match demo board configuration.
154 // Address assignment
155 // LTC2991 I2C Address // AD2 AD1 AD0
156 #define LTC2991_I2C_ADDRESS 0x48 // Low Low Low
157 // #define LTC2991_I2C_ADDRESS 0x49 // Low Low High
158 // #define LTC2991_I2C_ADDRESS 0x4A // Low High Low
159 // #define LTC2991_I2C_ADDRESS 0x4B // Low High High
160 // #define LTC2991_I2C_ADDRESS 0x4C // High Low Low
161 // #define LTC2991_I2C_ADDRESS 0x4D // High Low High
162 // #define LTC2991_I2C_ADDRESS 0x4E // High High Low
163 // #define LTC2991_I2C_ADDRESS 0x4F // High High High
164 
165 //! LTC2991 Global I2C Address.
166 #define LTC2991_I2C_GLOBAL_ADDRESS 0x77 // Global Address
167 
168 /*! @} */
169 /*! @name REGISTERS
170 @{ */
171 
172 #define LTC2991_STATUS_LOW_REG 0x00 //!< Data_Valid Bits(V1 Through V8)
173 #define LTC2991_STATUS_HIGH_REG 0x01 //!< Data_valid bits
174 #define LTC2991_CHANNEL_ENABLE_REG 0x01 //!< Channel Enable, Vcc, T_internal Conversion Status, Trigger
175 #define LTC2991_CONTROL_V1234_REG 0x06 //!< V1, V2, V3, and V4 Control Register
176 #define LTC2991_CONTROL_V5678_REG 0x07 //!< V5, V6, V7, AND V8 Control Register
177 #define LTC2991_CONTROL_PWM_Tinternal_REG 0x08 //!< PWM Threshold and T_internal Control Register
178 #define LTC2991_PWM_THRESHOLD_MSB_REG 0x09 //!< PWM Threshold
179 #define LTC2991_V1_MSB_REG 0x0A //!< V1, or T_R1 T MSB
180 #define LTC2991_V1_LSB_REG 0x0B //!< V1, or T_R1 T LSB
181 #define LTC2991_V2_MSB_REG 0x0C //!< V2, V1-V2, or T_R2 Voltage MSB
182 #define LTC2991_V2_LSB_REG 0x0D //!< V2, V1-V2, or T_R2 Voltage LSB
183 #define LTC2991_V3_MSB_REG 0x0E //!< V3, or T_R2 T MSB
184 #define LTC2991_V3_LSB_REG 0x0F //!< V3, or T_R2 T LSB
185 #define LTC2991_V4_MSB_REG 0x10 //!< V4, V3-V4, or T_R2 Voltage MSB
186 #define LTC2991_V4_LSB_REG 0x11 //!< V4, V3-V4, or T_R2 Voltage LSB
187 #define LTC2991_V5_MSB_REG 0x12 //!< V5, or T_R3 T MSB
188 #define LTC2991_V5_LSB_REG 0x13 //!< V5, or T_R3 T LSB
189 #define LTC2991_V6_MSB_REG 0x14 //!< V6, V5-V6, or T_R3 Voltage MSB
190 #define LTC2991_V6_LSB_REG 0x15 //!< V6, V5-V6, or T_R3 Voltage LSB
191 #define LTC2991_V7_MSB_REG 0x16 //!< V7, or T_R4 T MSB
192 #define LTC2991_V7_LSB_REG 0x17 //!< V7, or T_R4 T LSB
193 #define LTC2991_V8_MSB_REG 0x18 //!< V8, V7-V8, or T_R4 Voltage MSB
194 #define LTC2991_V8_LSB_REG 0x19 //!< V8, V7-V8, or T_R4 Voltage LSB
195 #define LTC2991_T_Internal_MSB_REG 0x1A //!< T_Internal MSB
196 #define LTC2991_T_Internal_LSB_REG 0x1B //!< T_Internal LSB
197 #define LTC2991_Vcc_MSB_REG 0x1C //!< Vcc MSB
198 #define LTC2991_Vcc_LSB_REG 0x1D //!< Vcc LSB
199 
200 /*! @} */
201 /*! @name LTC2991_CHANNEL_ENABLE_REG SETTINGS
202  Bitwise OR settings, and write to LTC2991_CHANNEL_ENABLE_REG to configure settings.
203  Bitwise AND with value read from LTC2991_CHANNEL_ENABLE_REG to determine present setting.
204 @{ */
205 
206 #define LTC2991_V7_V8_TR4_ENABLE 0x80 //!< Enable V7-V8 measurements, including TR4 temperature
207 #define LTC2991_V5_V6_TR3_ENABLE 0x40 //!< Enable V5-V6 measurements, including TR3 temperature
208 #define LTC2991_V3_V4_TR2_ENABLE 0x20 //!< Enable V3-V4 measurements, including TR2 temperature
209 #define LTC2991_V1_V2_TR1_ENABLE 0x10 //!< Enable V1-V2 measurements, including TR1 temperature
210 #define LTC2991_VCC_TINTERNAL_ENABLE 0x08 //!< Enable Vcc internal voltage measurement
211 #define LTC2991_ENABLE_ALL_CHANNELS 0xF8 //!< Use to enable all LTC2991 channels. Equivalent to bitwise OR'ing all channel enables.
212 #define LTC2991_BUSY 0x04 //!< LTC2991 Busy Bit
213 
214 /*! @} */
215 /*! @name LTC2991_CONTROL_V1234_REG SETTINGS
216  Bitwise OR settings, and write to LTC2991_CONTROL_V1234_REG to configure settings.
217  Bitwise AND with value read from LTC2991_CONTROL_V1234_REG to determine present setting.
218 @{ */
219 
220 #define LTC2991_V3_V4_FILTER_ENABLE 0x80 //!< Enable filters on V3-V4
221 #define LTC2991_V3_V4_KELVIN_ENABLE 0x40 //!< Enable V3-V4 for Kelvin. Otherwise, Celsius.
222 #define LTC2991_V3_V4_TEMP_ENABLE 0x20 //!< Enable V3-V4 temperature mode.
223 #define LTC2991_V3_V4_DIFFERENTIAL_ENABLE 0x10 //!< Enable V3-V4 differential mode. Otherwise, single-ended.
224 #define LTC2991_V1_V2_FILTER_ENABLE 0x08 //!< Enable filters on V1-V2
225 #define LTC2991_V1_V2_KELVIN_ENABLE 0x04 //!< Enable V1-V2 for Kelvin. Otherwise, Celsius.
226 #define LTC2991_V1_V2_TEMP_ENABLE 0x02 //!< Enable V1-V2 temperature mode.
227 #define LTC2991_V1_V2_DIFFERENTIAL_ENABLE 0x01 //!< Enable V1-V2 differential mode. Otherwise, single-ended.
228 
229 /*! @} */
230 /*! @name LTC2991_CONTROL_V5678_REG SETTINGS
231  Bitwise OR settings, and write to LTC2991_CONTROL_V5678_REG to configure settings.
232  Bitwise AND with value read from LTC2991_CONTROL_V5678_REG to determine present setting.
233 @{ */
234 
235 #define LTC2991_V7_V8_FILTER_ENABLE 0x80 //!< Enable filters on V7-V8
236 #define LTC2991_V7_V8_KELVIN_ENABLE 0x40 //!< Enable V7-V8 for Kelvin. Otherwise, Celsius.
237 #define LTC2991_V7_V8_TEMP_ENABLE 0x20 //!< Enable V7-V8 temperature mode.
238 #define LTC2991_V7_V8_DIFFERENTIAL_ENABLE 0x10 //!< Enable V7-V8 differential mode. Otherwise, single-ended.
239 #define LTC2991_V5_V6_FILTER_ENABLE 0x08 //!< Enable filters on V5-V6
240 #define LTC2991_V5_V6_KELVIN_ENABLE 0x04 //!< Enable V5-V6 for Kelvin. Otherwise, Celsius.
241 #define LTC2991_V5_V6_TEMP_ENABLE 0x02 //!< Enable V5-V6 temperature mode.
242 #define LTC2991_V5_V6_DIFFERENTIAL_ENABLE 0x01 //!< Enable V5-V6 differential mode. Otherwise, single-ended.
243 
244 /*! @} */
245 /*! @name LTC2991_CONTROL_PWM_Tinternal_REG SETTINGS
246  Bitwise OR settings, and write to LTC2991_CONTROL_PWM_Tinternal_REG to configure settings.
247  Bitwise AND with value read from LTC2991_CONTROL_PWM_Tinternal_REG to determine present setting.
248 @{ */
249 
250 #define LTC2991_PWM_0 0x80 //!< PWM threshold Least Significant Bit
251 #define LTC2991_PWM_INVERT 0x40 //!< Invert PWM
252 #define LTC2991_PWM_ENABLE 0x20 //!< Enable PWM
253 #define LTC2991_REPEAT_MODE 0x10 //!< Enable Repeated Aquisition Mode
254 #define LTC2991_INT_FILTER_ENABLE 0x08 //!< Enable Internal Temperature Filter
255 #define LTC2991_INT_KELVIN_ENABLE 0x04 //!< Enable internal temperature for Kelvin. Otherwise, Celsius.
256 /*!@} */
257 
258 //! Reads a 14-bit adc_code from LTC2991.
259 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
260 int8_t LTC2991_adc_read(uint8_t i2c_address, //!< I2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
261  uint8_t msb_register_address, /*!< Address of the LTC2991 MSB register to be read. This is also known as the "command byte".
262  Two sequential 8-bit registers are read, starting with the msb_register_address.*/
263  int16_t *adc_code, //!< returns 14-bit value read from the adc
264  int8_t *data_valid //!< returns the status of the DATA_VALID bit. *data_valid=0 indicates stale data
265  );
266 
267 //! Reads a 14-bit adc_code from the LTC2991 but enforces a maximum timeout.
268 //! 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)
269 //! expires. It keeps trying to read from the LTC2991 every millisecond until the data_valid bit is set (indicating new data since the previous
270 //! time this register was read) or until it fails to receive an I2C acknowledge (indicating an error on the I2C bus).
271 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
272 int8_t LTC2991_adc_read_timeout(uint8_t i2c_address, //!< I2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
273  uint8_t msb_register_address, /*!< Address of the LTC2991 MSB register to be read. This is also known as the "command byte".
274  Two sequential 8-bit registers will be read, starting with the msb_register_address.*/
275  int16_t *adc_code, //!< returns 14-bit value read from the adc
276  int8_t *data_valid, //!< returns the status of the DATA_VALID bit. *data_valid=0 indicates stale data
277  uint16_t timeout, //!< maximum timeout in millisceonds. If at any time a NACK is received the function aborts.
278  uint8_t status_bit //!< If the timeout is reached without valid data (*data_valid=1) the function exits.*/
279  );
280 
281 //! Reads new data (even after a mode change) by flushing old data and waiting for the data_valid bit to be set.
282 //! This function simplifies adc reads when modes are changing. For example, if V1-V2 changes from temperature mode
283 //! to differential voltage mode, the data in the register may still correspond to the temperature reading immediately
284 //! after the mode change. Flushing one reading and waiting for a new reading guarantees fresh data is received.
285 //! If the timeout is reached without valid data (*data_valid=1) the function exits.
286 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
287 int8_t LTC2991_adc_read_new_data(uint8_t i2c_address, //!< I2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
288  uint8_t msb_register_address, /*!< Address of the LTC2991 MSB register to be read. This is also known as the "command byte".
289  Two sequential 8-bit registers will be read, starting with the msb_register_address.*/
290  int16_t *adc_code, //!< returns 14-bit value read from the adc
291  int8_t *data_valid, //!< returns the status of the DATA_VALID bit. *data_valid=0 indicates stale data
292  uint16_t timeout /*!< maximum timeout in millisceonds. If at any time a NACK is received the function aborts.
293  If the timeout is reached without valid data (*data_valid=1) the function exits.*/
294  );
295 
296 //! Reads an 8-bit register from the LTC2991 using the standard repeated start format.
297 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
298 int8_t LTC2991_register_read(uint8_t i2c_address, //!< I2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
299  uint8_t register_address, //!< Address of the LTC2991 register to be read. This is also known as the "command byte".
300  uint8_t *register_data //!< returns 8-bit value read from the LTC2991 register.
301  );
302 
303 //! Write one byte to an LTC2991 register.
304 //! Writes to an 8-bit register inside the LTC2991 using the standard I2C repeated start format.
305 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
306 int8_t LTC2991_register_write(uint8_t i2c_address, //!< I2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
307  uint8_t register_address, //!< Address of the LTC2991 register to be overwritten. This is also known as the "command byte".
308  uint8_t register_data //!< Value that will be written to the register.
309  );
310 
311 
312 //! Used to set and clear bits in a control register. bits_to_set will be bitwise OR'd with the register.
313 //! 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.
314 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
315 int8_t LTC2991_register_set_clear_bits(uint8_t i2c_address, //!< I2C address of the LTC2991. Configured by tying the ADR0, ADR1, and ADR2 pins high or low. See Table 1 of datasheet.
316  uint8_t register_address, //!< Address of the LTC2991 register to be modified.
317  uint8_t bits_to_set, //!< bits_to_set will be bitwise OR'd with the register.
318  uint8_t bits_to_clear //!< bits_to_clear will be inverted and bitwise AND'd with the register
319  );
320 
321 //! Calculates the LTC2991 single-ended input voltages
322 //! @return the single-ended voCalculatesltage in volts
323 float LTC2991_code_to_single_ended_voltage(int16_t adc_code, //!< code read from the adc (from a function such as LTC2991_adc_read)
324  float LTC2991_single_ended_lsb //!< single-ended LSB weight. If not calibrated, use LTC2991_SINGLE_ENDED_LSB
325  );
326 
327 //! Calculates the LTC2991 Vcc voltage
328 //! @return the Vcc voltage in volts
329 float LTC2991_code_to_vcc_voltage(int16_t adc_code, //!< code read from the adc (from a function such as LTC2991_adc_read)
330  float LTC2991_single_ended_lsb //!< Vcc LSB weight. If not calibrated, use LTC2991_VCC_LSB
331  );
332 
333 //! Calculates the LTC2991 differential input voltage.
334 //! @return the differential voltage in volts
335 float LTC2991_code_to_differential_voltage(int16_t adc_code, //!< code read from the adc (from a function such as LTC2991_adc_read)
336  float LTC2991_differential_lsb //!< differential LSB weight. If not calibrated, use LTC2991_DIFFERENTIAL_LSB
337  );
338 
339 //! Calculates the LTC2991 temperature
340 //! @return the temperature in degrees Celsius or degrees Kevlin (dependent on mode setting).
341 float LTC2991_temperature(int16_t adc_code, //!< code read from the adc (from a function such as LTC2991_adc_read).
342  float LTC2991_temperature_lsb, //!< temperature LSB weight. If not calibrated, use LTC2991_TEMPERATURE_LSB
343  boolean unit //!< The temperature unit, true for Kelvin, false for Celsius
344  );
345 
346 //! Calcultates the LTC2991 diode voltage
347 //! @return the diode voltage in volts.
348 float LTC2991_code_to_diode_voltage(int16_t adc_code, //!< code read from the adc (from a function such as LTC2991_adc_read)
349  float LTC2991_diode_voltage_lsb //!< diode voltage LSB weight. If not calibrated, use LTC2991_DIODE_VOLTAGE_LSB
350  );
351 
352 #endif // LTC2991_H
const float LTC2991_TEMPERATURE_lsb
Typical temperature LSB weight in degrees Celsius (and Kelvin).
Definition: LTC2991.h:143
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.
Definition: LTC2991.cpp:93
float LTC2991_temperature(int16_t adc_code, float LTC2991_temperature_lsb, boolean unit)
Calculates the LTC2991 temperature.
Definition: LTC2991.cpp:230
uint8_t i2c_address
const float LTC2991_DIFFERENTIAL_lsb
Typical differential LSB weight in volts.
Definition: LTC2991.h:138
float LTC2991_code_to_vcc_voltage(int16_t adc_code, float LTC2991_single_ended_lsb)
Calculates the LTC2991 Vcc voltage.
Definition: LTC2991.cpp:201
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.
Definition: LTC2991.cpp:173
const float LTC2991_SINGLE_ENDED_lsb
Typical single-ended LSB weight in volts.
Definition: LTC2991.h:136
float LTC2991_code_to_differential_voltage(int16_t adc_code, float LTC2991_differential_lsb)
Calculates the LTC2991 differential input voltage.
Definition: LTC2991.cpp:216
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.
Definition: LTC2991.cpp:76
const float LTC2991_DIODE_VOLTAGE_lsb
Typical remote diode LSB weight in volts.
Definition: LTC2991.h:146
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 ...
Definition: LTC2991.cpp:142
float LTC2991_code_to_single_ended_voltage(int16_t adc_code, float LTC2991_single_ended_lsb)
Calculates the LTC2991 single-ended input voltages.
Definition: LTC2991.cpp:186
long timeout
int8_t LTC2991_register_write(uint8_t i2c_address, uint8_t register_address, uint8_t register_data)
Write one byte to an LTC2991 register.
Definition: LTC2991.cpp:163
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.
Definition: LTC2991.cpp:153
const float LTC2991_VCC_lsb
Typical VCC LSB weight in volts.
Definition: LTC2991.h:140
float LTC2991_code_to_diode_voltage(int16_t adc_code, float LTC2991_diode_voltage_lsb)
Calcultates the LTC2991 diode voltage.
Definition: LTC2991.cpp:247
static uint32_t adc_code
Definition: DC2071AA.ino:113