| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2492.cpp
Go to the documentation of this file.
1 /*!
2 LTC2492: 24-Bit, 4-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
3 @verbatim
4
5 The LTC2492 is a 4-channel (2-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/LTC2492
15
16 http://www.linear.com/product/LTC2492#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 LTC2492 LTC2492: 24-Bit, 4-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation
56 //! @}
57
58 /*! @file
59 @ingroup LTC2492
60 Library for LTC2492: 24-Bit, 4-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 "LTC2492.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 LTC2492_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
73 {
74 return(LTC24XX_EOC_timeout(cs, miso_timeout));
75 }
76
77 // Reads from LTC2492.
78 void LTC2492_read(uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
79 {
80 LTC24XX_SPI_16bit_command_32bit_data(cs, adc_command_high, adc_command_low, adc_code); // Transfer arrays
81 }
82
83 // Calculates the voltage corresponding to an adc code, given lsb weight (in volts)
84 float LTC2492_code_to_voltage(int32_t adc_code, float vref)
85 {
86 return(LTC24XX_diff_code_to_voltage(adc_code, vref));
87 }
Linduino.h
Header File for Linduino Libraries and Demo Code.
LTC24XX_EOC_timeout
int8_t LTC24XX_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
Definition: LTC24XX_general.cpp:82
LTC2492.h
LTC2492: 24-Bit, 4-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation.
LTC24XX_general.h
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
LTC24XX_SPI_16bit_command_32bit_data
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.
Definition: LTC24XX_general.cpp:136
LTC2492_code_to_voltage
float LTC2492_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an adc code, given the reference (in volts) ...
Definition: LTC2492.cpp:84
LTC2492_EOC_timeout
int8_t LTC2492_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
Definition: LTC2492.cpp:72
LT_I2C.h
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
LTC24XX_diff_code_to_voltage
float LTC24XX_diff_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference voltage. ...
Definition: LTC24XX_general.cpp:389
LTC2492_read
void LTC2492_read(uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
Reads from LTC2492.
Definition: LTC2492.cpp:78
vref
float vref
Definition: LTC2492_Thermocouple_Meter.ino:129
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113