Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2499.cpp
Go to the documentation of this file.
1 /*!
2 LTC2499: 24-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
3 
4 @verbatim
5 
6 The LTC2499 is a 16-channel (eight differential), 24-bit, No Latency DS TM
7 ADC with Easy Drive technology and a 2-wire, I2C interface. The patented
8 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/LTC2499
17 
18 http://www.linear.com/product/LTC2499#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 LTC2499 LTC2499: 24-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
58 //! @}
59 
60 /*! @file
61  @ingroup LTC2499
62  Library for LTC2499: 24-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
63 */
64 
65 
66 #include <stdint.h>
67 #include <Arduino.h>
68 #include "Linduino.h"
69 #include "LTC2499.h"
70 #include "LTC24XX_general.h"
71 #include "USE_WIRE.h"
72 
73 #ifdef USEWIRE
74 #include "LT_I2C_Wire.h"
75 #else
76 #include "LT_I2C.h"
77 #endif
78 
79 // Reads from LTC2499.
80 uint8_t LTC2499_read(uint8_t i2c_address, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code, uint16_t timeout)
81 {
82  return (LTC24XX_I2C_16bit_command_32bit_data(i2c_address, adc_command_high,
83  adc_command_low, adc_code, timeout)); // Transfer data
84 }
85 
86 // Calculates the voltage corresponding to an adc code, given lsb weight (in volts)
87 float LTC2499_code_to_voltage(int32_t adc_code, float vref)
88 {
89 
90  return(LTC24XX_diff_code_to_voltage(adc_code, vref));
91 }
uint8_t i2c_address
Header File for Linduino Libraries and Demo Code.
uint8_t LTC2499_read(uint8_t i2c_address, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code, uint16_t timeout)
Reads from LTC2499.
Definition: LTC2499.cpp:80
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
int8_t LTC24XX_I2C_16bit_command_32bit_data(uint8_t i2c_address, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
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. ...
float LTC2499_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an adc code, given the reference (in volts) ...
Definition: LTC2499.cpp:87
LTC2499: 24-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation.
static uint32_t adc_code
Definition: DC2071AA.ino:113