| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2338.h
Go to the documentation of this file.
1 /*!
2 LTC2326-16: 16-Bit, 250ksps Pseudo-differential input ADC.
3 LTC2326-18: 18-Bit, 250ksps Pseudo-differential input ADC.
4 LTC2327-16: 16-Bit, 500ksps Pseudo-differential input ADC
5 LTC2327-18: 18-Bit, 500ksps Pseudo-differential input ADC
6 LTC2328-16: 16-Bit, 1Msps Pseudo-differential input ADC
7 LTC2328-18: 18-Bit, 1Msps Pseudo-differential input ADC
8 LTC2336-18: 18-Bit, 250ksps Fully-differential input ADC
9 LTC2337-18: 18-Bit, 500ksps Fully-differential ADC
10 LTC2338-18: 18-Bit, 1Msps Fully-differential input ADC
11
12 @verbatim
13
14 The following parts (DUT) are pin-compatible, 16/18-bit A/D converters with serial I/O, and an internal reference:
15 LTC2326-16: 16-Bit, 250ksps Pseudo-differential input ADC.
16 LTC2326-18: 18-Bit, 250ksps Pseudo-differential input ADC.
17 LTC2327-16: 16-Bit, 500ksps Pseudo-differential input ADC
18 LTC2327-18: 18-Bit, 500ksps Pseudo-differential input ADC
19 LTC2328-16: 16-Bit, 1Msps Pseudo-differential input ADC
20 LTC2328-18: 18-Bit, 1Msps Pseudo-differential input ADC
21 LTC2336-18: 18-Bit, 250ksps Fully-differential input ADC
22 LTC2337-18: 18-Bit, 500ksps Fully-differential ADC
23 LTC2338-18: 18-Bit, 1Msps Fully-differential input ADC
24
25 Example Code:
26
27 Read ADC input.
28
29 LTC2338_read(LTC2338_CS, &adc_code); // Throws out last reading
30 LTC2338_read(LTC2338_CS, &adc_code); // Obtains the current reading and stores to adc_code variable
31
32 // Convert adc_code to voltage
33 adc_voltage = LTC2338_code_to_voltage(adc_code, vref);
34
35 @endverbatim
36
37 http://www.linear.com/product/LTC2326-16
38 http://www.linear.com/product/LTC2326-18
39 http://www.linear.com/product/LTC2327-16
40 http://www.linear.com/product/LTC2327-18
41 http://www.linear.com/product/LTC2328-16
42 http://www.linear.com/product/LTC2328-18
43 http://www.linear.com/product/LTC2336-18
44 http://www.linear.com/product/LTC2337-18
45 http://www.linear.com/product/LTC2338-18
46
47 http://www.linear.com/product/LTC2326-16#demoboards
48 http://www.linear.com/product/LTC2326-18#demoboards
49 http://www.linear.com/product/LTC2327-16#demoboards
50 http://www.linear.com/product/LTC2327-18#demoboards
51 http://www.linear.com/product/LTC2328-16#demoboards
52 http://www.linear.com/product/LTC2328-18#demoboards
53 http://www.linear.com/product/LTC2336-18#demoboards
54 http://www.linear.com/product/LTC2337-18#demoboards
55 http://www.linear.com/product/LTC2338-18#demoboards
56
57
58 Copyright 2018(c) Analog Devices, Inc.
59
60 All rights reserved.
61
62 Redistribution and use in source and binary forms, with or without
63 modification, are permitted provided that the following conditions are met:
64 - Redistributions of source code must retain the above copyright
65 notice, this list of conditions and the following disclaimer.
66 - Redistributions in binary form must reproduce the above copyright
67 notice, this list of conditions and the following disclaimer in
68 the documentation and/or other materials provided with the
69 distribution.
70 - Neither the name of Analog Devices, Inc. nor the names of its
71 contributors may be used to endorse or promote products derived
72 from this software without specific prior written permission.
73 - The use of this software may or may not infringe the patent rights
74 of one or more patent holders. This license does not release you
75 from the requirement that you obtain separate licenses from these
76 patent holders to use this software.
77 - Use of the software either in source or binary form, must be run
78 on or directly connected to an Analog Devices Inc. component.
79
80 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
81 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
82 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
83 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
84 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
85 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
86 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
87 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
88 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
89 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90 */
91
92 /*! @file
93 @ingroup LTC2338
94 Header for LTC2338: 16/18-bit 1Msps ADC
95 */
96
97 #ifndef LTC2338_H
98 #define LTC2338_H
99
100 #include <SPI.h>
101
102 //! Define the SPI CS pin
103 #ifndef LTC2338_CS
104 #define LTC2338_CS QUIKEVAL_CS
105 #endif
106
107 //! @name LTC2338 Channel Address
108 //! @{
109 // Channel Address
110 #define LTC2338_ADDRESS 0x00
111 //!@}
112
113
114 //! Reads the LTC2338 and returns 32-bit data in 2's complement format
115 //! @return void
116 void LTC2338_read(uint8_t cs, //!< Chip Select Pin
117 int32_t *ptr_adc_code //!< Returns code read from ADC (from previous conversion)
118 );
119
120
121 //! Calculates the LTC2338 input voltage given the binary data and lsb weight.
122 //! @return Floating point voltage
123 float LTC2338_code_to_voltage(int32_t adc_code, //!< Raw ADC code
124 float vref //!< Reference voltage
125 );
126
127 #endif // LTC2338_H
128
129
LTC2338_code_to_voltage
float LTC2338_code_to_voltage(int32_t adc_code, float vref)
Calculates the LTC2338 input voltage given the binary data and lsb weight.
Definition: LTC2338.cpp:123
LTC2338_read
void LTC2338_read(uint8_t cs, int32_t *ptr_adc_code)
Reads the LTC2338 and returns 32-bit data in 2&#39;s complement format.
Definition: LTC2338.cpp:101
vref
float vref
Definition: LTC2492_Thermocouple_Meter.ino:129
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113