| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2412.h
Go to the documentation of this file.
1 /*!
2 LTC2412: 2-Channel Differential Input 24-Bit No Latency Delta Sigma ADC
3 LTC2413: 24-Bit No Latency Delta Sigma ADC with Simultaneous 50Hz/60Hz Rejection ADC
4
5 @verbatim
6
7 The LTC2412 is a 2-channel differential input micropower 24-bit No Latency
8 Delta-Sigma analog-to-digital converter with an integrated oscillator. It
9 provides 2ppm INL and 0.16ppm RMS noise over the entire supply range. The two
10 differential channels are converted alternately with channel ID included in
11 the conversion results.
12
13 The converter accepts any external differential reference voltage from 0.1V to
14 VCC for flexible ratiometric and remote sensingmeasurement configurations. The
15 full-scale differential input range is from –0.5VREF to 0.5VREF. The LTC2412
16 communicates through a flexible 3-wire digital interface which is compatible
17 with SPI and MICROWIRE protocols.
18
19 SPI DATA FORMAT (MSB First):
20
21 Byte #1 Byte #2 Byte #3 Byte #4
22
23 Data Out : !EOC CH SIG D23 D22 D21 D20 D19 D18 D17 D16 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 X X X X X
24
25 !EOC : End of Conversion Bit (Active Low)
26 CH : Channel selected
27 SIG : Sign Bit (1-data positive, 0-data negative)
28 Dx : Data Bits
29
30
31 Example Code:
32
33 Read Channel 0 in Single-Ended mode
34
35 uint16_t miso_timeout = 1000;
36
37 if(LTC2412_EOC_timeout(LTC2412_CS, miso_timeout)) // Check for EOC
38 return(1);
39 LTC2412_read(LTC2412_CS, &adc_code); // Obtains the current reading and stores to adc_code variable
40
41 // Convert adc_code to voltage
42 adc_voltage = LTC2412_code_to_voltage(adc_code, LTC2412_lsb , LTC2412_offset_code);
43
44 @endverbatim
45
46 http://www.linear.com/product/LTC2412
47 http://www.linear.com/product/LTC2413
48
49 http://www.linear.com/product/LTC2412#demoboards
50 http://www.linear.com/product/LTC2413#demoboards
51
52
53 Copyright 2018(c) Analog Devices, Inc.
54
55 All rights reserved.
56
57 Redistribution and use in source and binary forms, with or without
58 modification, are permitted provided that the following conditions are met:
59 - Redistributions of source code must retain the above copyright
60 notice, this list of conditions and the following disclaimer.
61 - Redistributions in binary form must reproduce the above copyright
62 notice, this list of conditions and the following disclaimer in
63 the documentation and/or other materials provided with the
64 distribution.
65 - Neither the name of Analog Devices, Inc. nor the names of its
66 contributors may be used to endorse or promote products derived
67 from this software without specific prior written permission.
68 - The use of this software may or may not infringe the patent rights
69 of one or more patent holders. This license does not release you
70 from the requirement that you obtain separate licenses from these
71 patent holders to use this software.
72 - Use of the software either in source or binary form, must be run
73 on or directly connected to an Analog Devices Inc. component.
74
75 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
76 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
77 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
78 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
79 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
80 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
81 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
82 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
83 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
84 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85 */
86
87 /*! @file
88 @ingroup LTC2412
89 Header for LTC2412: 2-Channel Differential Input 24-Bit No Latency Delta Sigma ADC
90 */
91
92 #ifndef LTC2412_H
93 #define LTC2412_H
94
95 #include <SPI.h>
96
97 //! Define the SPI CS pin
98 #ifndef LTC2412_CS
99 #define LTC2412_CS QUIKEVAL_CS
100 #endif
101
102 //! Checks for EOC with a specified timeout
103 //! @return 0=successful, 1=unsuccessful (exceeded timeout)
104 int8_t LTC2412_EOC_timeout(uint8_t cs, //!< Chip Select pin
105 uint16_t miso_timeout //!< Timeout (ms)
106 );
107
108 //! Reads the LTC2412 result
109 //! @return void
110 void LTC2412_read(uint8_t cs, //!< Chip Select pin
111 uint32_t *adc_code //!< Returns raw 32-bit code read from ADC
112 );
113
114 //! Calculates the LTC2412 input voltage
115 //! @return Calculated voltage
116 float LTC2412_code_to_voltage(int32_t adc_code, //!< Raw ADC code
117 float LTC2412_lsb, //!< LSB value (volts)
118 int32_t LTC2412_offset_code //!< Offset (Code)
119 );
120
121 #endif // LTC2412_H
LTC2412_code_to_voltage
float LTC2412_code_to_voltage(int32_t adc_code, float LTC2412_lsb, int32_t LTC2412_offset_code)
Calculates the LTC2412 input voltage.
Definition: LTC2412.cpp:113
LTC2412_lsb
static float LTC2412_lsb
Ideal LSB voltage for a perfect part.
Definition: DC746A.ino:114
LTC2412_read
void LTC2412_read(uint8_t cs, uint32_t *adc_code)
Reads the LTC2412 result.
Definition: LTC2412.cpp:98
LTC2412_EOC_timeout
int8_t LTC2412_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
Definition: LTC2412.cpp:79
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113
LTC2412_offset_code
static int32_t LTC2412_offset_code
Ideal offset for a perfect part.
Definition: DC746A.ino:115