| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

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