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