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