Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2473.cpp
Go to the documentation of this file.
1 /*!
2 LTC2473: 16-Bit, Delta Sigma ADC with I2C interface.
3 
4 @verbatim
5 
6 The LTC2471/LTC2473 are small, 16-bit analog-to-digital converters with an
7 integrated precision reference and a selectable 208sps or 833sps output
8 rate. They use a single 2.7V to 5.5V supply and communicate through an I2C
9 Interface. The LTC2471 is single-ended with a 0V to VREF input range and
10 the LTC2473 is differential with a +-VREF input range. Both ADC's include
11 a 1.25V integrated reference with 2ppm/C drift performance and 0.1% initial
12 accuracy. They include an integrated oscillator and perform conversions with
13 no latency for multiplexed applications. The LTC2471/LTC2473 include a
14 proprietary input sampling scheme that reduces the average input current
15 several orders of magnitude when compared to conventional delta sigma
16 converters.
17 
18 @endverbatim
19 
20 http://www.linear.com/product/LTC2473
21 
22 http://www.linear.com/product/LTC2473#demoboards
23 
24 
25 Copyright 2018(c) Analog Devices, Inc.
26 
27 All rights reserved.
28 
29 Redistribution and use in source and binary forms, with or without
30 modification, are permitted provided that the following conditions are met:
31  - Redistributions of source code must retain the above copyright
32  notice, this list of conditions and the following disclaimer.
33  - Redistributions in binary form must reproduce the above copyright
34  notice, this list of conditions and the following disclaimer in
35  the documentation and/or other materials provided with the
36  distribution.
37  - Neither the name of Analog Devices, Inc. nor the names of its
38  contributors may be used to endorse or promote products derived
39  from this software without specific prior written permission.
40  - The use of this software may or may not infringe the patent rights
41  of one or more patent holders. This license does not release you
42  from the requirement that you obtain separate licenses from these
43  patent holders to use this software.
44  - Use of the software either in source or binary form, must be run
45  on or directly connected to an Analog Devices Inc. component.
46 
47 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
48 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
49 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
50 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
51 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
53 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 */
58 
59 //! @ingroup Analog_to_Digital_Converters
60 //! @{
61 //! @defgroup LTC2473 LTC2473: 16-Bit, Delta Sigma ADC with I2C interface
62 //! @}
63 
64 /*! @file
65  @ingroup LTC2473
66  Library for LTC2473: 16-Bit, Delta Sigma ADC with I2C interface
67 */
68 
69 #include <stdint.h>
70 #include <Arduino.h>
71 #include "Linduino.h"
72 #include "LT_I2C.h"
73 #include "LTC2473.h"
74 #include "LTC24XX_general.h"
75 
76 // Reads from LTC2473.
77 uint8_t LTC2473_read(uint8_t i2c_address, int32_t *adc_code, uint16_t timeout)
78 {
79  uint8_t ack = 0;
80  ack = LTC24XX_I2C_32bit_data( i2c_address, adc_code, timeout); // Read data
81  return ack;
82 }
83 
84 // Write to the LTC2473
85 uint8_t LTC2473_write(uint8_t i2c_address, uint8_t adc_command)
86 {
87  int32_t data;
88  uint8_t ack = 0;
89  ack = LTC24XX_I2C_8bit_command_32bit_data(i2c_address, adc_command, &data, 300); // Write command
90  return ack;
91 }
92 
93 // Calculates the voltage corresponding to an adc code, given the reference (in volts)
94 float LTC2473_code_to_voltage(int32_t adc_code, float vref)
95 {
96  float adc_voltage;
97  adc_voltage = LTC24XX_diff_code_to_voltage(adc_code, vref);
98  return(adc_voltage);
99 }
uint8_t i2c_address
static uint8_t adc_command
Definition: DC2071AA.ino:111
uint8_t LTC2473_read(uint8_t i2c_address, int32_t *adc_code, uint16_t timeout)
Reads from LTC2473.
Definition: LTC2473.cpp:77
Header File for Linduino Libraries and Demo Code.
float LTC2473_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference (in volts) ...
Definition: LTC2473.cpp:94
static float adc_voltage
Definition: DC2071AA.ino:115
union LT_union_int32_4bytes data
Definition: DC2094A.ino:138
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
uint8_t LTC2473_write(uint8_t i2c_address, uint8_t adc_command)
Writes to the LTC2473.
Definition: LTC2473.cpp:85
LTC2473: 16-Bit, Delta Sigma ADC with I2C interface.
long timeout
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
int8_t LTC24XX_I2C_8bit_command_32bit_data(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
int8_t LTC24XX_I2C_32bit_data(uint8_t i2c_address, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
float LTC24XX_diff_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference voltage. ...
static uint32_t adc_code
Definition: DC2071AA.ino:113