| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2440.h
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
19 SPI DATA FORMAT (MSB First):
20
21 Byte #1 Byte #2
22
23 Data Out : !EOC DMY SIG D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16
24 Data In : OSR4 OSR3 OSR2 OSR1 OSR1 X X X X X X X X X X X
25
26 Byte #3 Byte #4
27 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 *D3 *D2 *D1 *D0
28 X X X X X X X X X X X X X X X X
29
30 !EOC : End of Conversion Bit (Active Low)
31 DMY : Dummy Bit (Always 0)
32 SIG : Sign Bit (1-data positive, 0-data negative)
33 Dx : Data Bits
34 EN : Enable Bit (0-keep previous mode, 1-change mode)
35 SGL : Enable Single-Ended Bit (0-differential, 1-single-ended)
36 Sx : Address Select Bit
37 0SRX : Over Sampling Rate Bits
38
39 | CONVERSION RATE |
40 | INTERNAL | EXTERNAL |
41 OSR4 OSR3 OSR2 OSR1 OSR1 | 9MHz CLOCK | 10.24MHz CLOCK | RMS NOISE | ENOB | OSR
42 x 0 0 0 1 3.52kHz 4kHz 23uV 17 64
43 x 0 0 1 0 1.76kHz 2kHz 3.5uV 20 128
44 0 0 0 0 0 880Hz 1kHz 2uV 21.3 256*
45 x 0 0 1 1 880Hz 1kHz 2uV 21.3 256
46 x 0 1 0 0 440Hz 500Hz 1.4uV 21.8 512
47 x 0 1 0 1 220Hz 250Hz 1uV 22.4 1024
48 x 0 1 1 0 110Hz 125Hz 750nV 22.9 2048
49 x 0 1 1 1 55Hz 62.5Hz 510nV 23.4 4096
50 x 1 0 0 0 27.5Hz 31.25Hz 375nV 24 8192
51 X 1 0 0 1 13.75Hz 15.625Hz 250nV 24.4 16384
52 X 1 1 1 1 6.87kHz 7.8125Hz 200nV 24.6 32768**
53 ** Address allows tying SDI HIGH *Additional address to allow tying SDI LOW
54
55
56 Example Code:
57
58 Read ADC with OSR of 65536
59
60 uint16_t miso_timeout = 1000;
61
62 if(!LTC2440_EOC_timeout(LTC2440_CS, miso_timeout)) // Check for EOC
63 LTC2440_read(LTC2440_CS, adc_command, &adc_code); // Throws out reading
64 else
65 {
66 return;
67 }
68
69 if(!LTC2440_EOC_timeout(LTC2440_CS, miso_timeout)) // Check for EOC
70 LTC2440_read(LTC2440_CS, adc_command, &adc_code); // Take valid reading
71 else
72 {
73 return;
74 }
75
76 // Convert adc_code to voltage
77 adc_voltage = LTC2440_code_to_voltage(adc_code, LTC2440_vref);
78
79 @endverbatim
80
81 http://www.linear.com/product/LTC2440
82
83 http://www.linear.com/product/LTC2440#demoboards
84
85
86 Copyright 2018(c) Analog Devices, Inc.
87
88 All rights reserved.
89
90 Redistribution and use in source and binary forms, with or without
91 modification, are permitted provided that the following conditions are met:
92 - Redistributions of source code must retain the above copyright
93 notice, this list of conditions and the following disclaimer.
94 - Redistributions in binary form must reproduce the above copyright
95 notice, this list of conditions and the following disclaimer in
96 the documentation and/or other materials provided with the
97 distribution.
98 - Neither the name of Analog Devices, Inc. nor the names of its
99 contributors may be used to endorse or promote products derived
100 from this software without specific prior written permission.
101 - The use of this software may or may not infringe the patent rights
102 of one or more patent holders. This license does not release you
103 from the requirement that you obtain separate licenses from these
104 patent holders to use this software.
105 - Use of the software either in source or binary form, must be run
106 on or directly connected to an Analog Devices Inc. component.
107
108 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
109 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
110 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
111 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
112 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
113 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
114 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
115 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
116 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
117 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
118 */
119
120 /*! @file
121 @ingroup LTC2440
122 Header for LTC2440: 24-Bit, Differential Delta Sigma ADCs with Selectable Speed/Resolution.
123 */
124
125 #ifndef LTC2440_H
126 #define LTC2440_H
127
128 //! Define the SPI CS pin
129 #ifndef LTC2440_CS
130 #define LTC2440_CS QUIKEVAL_CS
131 #endif
132
133 /*! @name Oversample Ratio (OSR) Commands
134 @{ */
135 #define LTC2440_OSR_64 0x08
136 #define LTC2440_OSR_128 0x10
137 #define LTC2440_OSR_256_ 0x00 // See note above
138 #define LTC2440_OSR_256 0x18
139 #define LTC2440_OSR_512 0x20
140 #define LTC2440_OSR_1024 0x28
141 #define LTC2440_OSR_2048 0x30
142 #define LTC2440_OSR_4096 0x38
143 #define LTC2440_OSR_8192 0x40
144 #define LTC2440_OSR_16384 0x48
145 #define LTC2440_OSR_32768 0x78
146 /*! @}*/
147
148
149 //! Checks for EOC with a specified timeout.
150 //! @return Returns 0=successful, 1=unsuccessful (exceeded timeout)
151 int8_t LTC2440_EOC_timeout(uint8_t cs, //!< Chip Select pin
152 uint16_t miso_timeout //!< Timeout (in milliseconds)
153 );
154
155 //! Reads from LTC2440.
156 void LTC2440_read( uint8_t cs, //!< Chip select
157 uint8_t adc_command, //!< 1 byte command written to LTC2440
158 int32_t *adc_code //!< 4 byte conversion code read from LTC2440
159 );
160
161 //! Calculates the voltage corresponding to an adc code, given the reference (in volts)
162 //! @return Returns voltage calculated from ADC code.
163 float LTC2440_code_to_voltage(int32_t adc_code, //!< Code read from adc
164 float vref //!< VRef (in volts)
165 );
166 #endif // LTC2440_H
adc_command
static uint8_t adc_command
Definition: DC2071AA.ino:111
LTC2440_code_to_voltage
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
LTC2440_EOC_timeout
int8_t LTC2440_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
Definition: LTC2440.cpp:80
LTC2440_read
void LTC2440_read(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC2440.
Definition: LTC2440.cpp:86
vref
float vref
Definition: LTC2492_Thermocouple_Meter.ino:129
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113