| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

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