Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2497.cpp
Go to the documentation of this file.
1 /*!
2 LTC2497: 16-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation.
3 
4 @verbatim
5 
6 The LTC2497 is a 16-channel (eight differential), 16-bit, No Latency Delta
7 Sigma TM ADC with Easy Drive technology and a 2-wire, I2C interface. The
8 patented sampling scheme eliminates dynamic input current errors and the
9 shortcomings of on-chip buffering through automatic cancellation of
10 differential input current. This allows large external source impedances
11 and rail-to-rail input signals to be directly digitized while maintaining
12 exceptional DC accuracy.
13 
14 @endverbatim
15 
16 http://www.linear.com/product/LTC2497
17 
18 http://www.linear.com/product/LTC2497#demoboards
19 
20 
21 Copyright 2018(c) Analog Devices, Inc.
22 
23 All rights reserved.
24 
25 Redistribution and use in source and binary forms, with or without
26 modification, are permitted provided that the following conditions are met:
27  - Redistributions of source code must retain the above copyright
28  notice, this list of conditions and the following disclaimer.
29  - Redistributions in binary form must reproduce the above copyright
30  notice, this list of conditions and the following disclaimer in
31  the documentation and/or other materials provided with the
32  distribution.
33  - Neither the name of Analog Devices, Inc. nor the names of its
34  contributors may be used to endorse or promote products derived
35  from this software without specific prior written permission.
36  - The use of this software may or may not infringe the patent rights
37  of one or more patent holders. This license does not release you
38  from the requirement that you obtain separate licenses from these
39  patent holders to use this software.
40  - Use of the software either in source or binary form, must be run
41  on or directly connected to an Analog Devices Inc. component.
42 
43 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
44 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
45 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
47 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
49 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54 
55 //! @ingroup Analog_to_Digital_Converters
56 //! @{
57 //! @defgroup LTC2497 LTC2497: 16-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
58 //! @}
59 
60 /*! @file
61  @ingroup LTC2497
62  Library for LTC2497: 16-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
63 */
64 
65 #include <stdint.h>
66 #include <Arduino.h>
67 #include "Linduino.h"
68 #include "LTC2497.h"
69 #include "LTC24XX_general.h"
70 #include "USE_WIRE.h"
71 
72 #ifdef USEWIRE
73 #include "LT_I2C_Wire.h"
74 #else
75 #include "LT_I2C.h"
76 #endif
77 
78 // Reads from LTC2497.
79 uint8_t LTC2497_read(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t timeout)
80 {
81  return (LTC24XX_I2C_8bit_command_24bit_data(i2c_address, adc_command, adc_code, timeout));
82 }
83 
84 // Calculates the voltage corresponding to an ADC code, given the reference (in volts)
85 float LTC2497_code_to_voltage(int32_t adc_code, float vref)
86 {
87  return (LTC24XX_diff_code_to_voltage(adc_code, vref));
88 }
uint8_t i2c_address
static uint8_t adc_command
Definition: DC2071AA.ino:111
LTC2497: 16-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation.
Header File for Linduino Libraries and Demo Code.
float LTC2497_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference (in volts) ...
Definition: LTC2497.cpp:85
int8_t LTC24XX_I2C_8bit_command_24bit_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 24 bit result.
uint8_t LTC2497_read(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t timeout)
Reads from LTC2497.
Definition: LTC2497.cpp:79
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
long timeout
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
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