Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2440.cpp
Go to the documentation of this file.
1 /*!
2 LTC2440: 24-Bit, Differential Delta Sigma ADCs with Selectable Speed/Resolution.
3 
4 @verbatim
5 
6 The LTC2440 is a high speed 24-bit No Latency Delta Sigma TM ADC with 5ppm
7 INL and 5uV offset. It uses proprietary delta-sigma architecture enabling
8 variable speed and resolution with no latency. Ten speed/resolution
9 combinations (6.9Hz/200nVRMS to 3.5kHz/25uVRMS) are programmed through a
10 simple serial interface. Alternatively, by tying a single pin HIGH or
11 LOW, a fast (880Hz/2uVRMS) or ultralow noise (6.9Hz, 200nVRMS, 50/60Hz
12 rejection) speed/resolution combination can be easily selected. The
13 accuracy (offset, full-scale, linearity, drift) and power dissipation are
14 independent of the speed selected. Since there is no latency, a
15 speed/resolution change may be made between conversions with no
16 degradation in performance.
17 
18 @endverbatim
19 
20 http://www.linear.com/product/LTC2440
21 
22 http://www.linear.com/product/LTC2440#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 LTC2440 LTC2440: 24-Bit, Differential Delta Sigma ADCs with Selectable Speed/Resolution
62 //! @}
63 
64 /*! @file
65  @ingroup LTC2440
66  Library for LTC2440: 24-Bit, Differential Delta Sigma ADCs with Selectable Speed/Resolution
67 */
68 
69 #include <stdint.h>
70 #include <Arduino.h>
71 #include "Linduino.h"
72 #include "LT_I2C.h"
73 #include "LT_SPI.h"
74 #include "LTC2440.h"
75 #include "LTC24XX_general.h"
76 
77 
78 // Checks for EOC with a specified timeout.
79 // Returns 0=successful, 1=unsuccessful (exceeded timeout)
80 int8_t LTC2440_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
81 {
82  return(LTC24XX_EOC_timeout(cs, miso_timeout));
83 }
84 
85 // Reads from LTC2440.
86 void LTC2440_read(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
87 {
88  LTC24XX_SPI_8bit_command_32bit_data(cs, adc_command, adc_code); // Transfer data
89 }
90 
91 // Calculates the voltage corresponding to an ADC code, given the reference (in volts)
92 float LTC2440_code_to_voltage(int32_t adc_code, float vref)
93 {
94  return(LTC24XX_diff_code_to_voltage(adc_code, vref));
95 }
float LTC2440_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an adc code, given the reference (in volts) ...
Definition: LTC2440.cpp:92
static uint8_t adc_command
Definition: DC2071AA.ino:111
int8_t LTC2440_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
Definition: LTC2440.cpp:80
Header File for Linduino Libraries and Demo Code.
int8_t LTC24XX_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
LTC2440: 24-Bit, Differential Delta Sigma ADCs with Selectable Speed/Resolution.
void LTC24XX_SPI_8bit_command_32bit_data(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
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. ...
void LTC2440_read(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC2440.
Definition: LTC2440.cpp:86
static uint32_t adc_code
Definition: DC2071AA.ino:113