Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2480.h
Go to the documentation of this file.
1 /*!
2 LTC2480: 16-Bit Delta-Sigma ADC with Easy Drive Input Current Cancellation.
3 
4 @verbatim
5 
6 The LTC2480 is a 16-Bit Delta-Sigma ADC with Easy Drive Input Current Cancellation.
7 It includes on-chip programmable gain and an oscillator. The LTC2480 can be
8 configured to provide a programmable gain from 1 to 256 in 8 steps, measure an
9 external signal or internal temperature sensor and reject line frequencies. 50Hz,
10 60Hz or simultaneous 50Hz/60Hz line frequency rejection can be selected as well
11 as a 2x speed-up mode.
12 
13 Example Code:
14 
15 Read ADC input.
16 
17  LTC2480_read(LTC2480_CS, &adc_code); // Throws out last reading
18  LTC2480_read(LTC2480_CS, &adc_code); // Obtains the current reading and stores to adc_code variable
19 
20  display_code = adc_code >> 4;
21  display_code = display_code & 0xFFFF;
22 
23  // Convert adc_code to voltage
24  adc_voltage = LTC2480_code_to_voltage(display_code, vref, gain);
25 
26 @endverbatim
27 
28 http://www.linear.com/product/LTC2480
29 
30 http://www.linear.com/product/LTC2480#demoboards
31 
32 
33 Copyright 2018(c) Analog Devices, Inc.
34 
35 All rights reserved.
36 
37 Redistribution and use in source and binary forms, with or without
38 modification, are permitted provided that the following conditions are met:
39  - Redistributions of source code must retain the above copyright
40  notice, this list of conditions and the following disclaimer.
41  - Redistributions in binary form must reproduce the above copyright
42  notice, this list of conditions and the following disclaimer in
43  the documentation and/or other materials provided with the
44  distribution.
45  - Neither the name of Analog Devices, Inc. nor the names of its
46  contributors may be used to endorse or promote products derived
47  from this software without specific prior written permission.
48  - The use of this software may or may not infringe the patent rights
49  of one or more patent holders. This license does not release you
50  from the requirement that you obtain separate licenses from these
51  patent holders to use this software.
52  - Use of the software either in source or binary form, must be run
53  on or directly connected to an Analog Devices Inc. component.
54 
55 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
56 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
57 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
58 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
59 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
61 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
62 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
63 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 */
66 
67 /*! @file
68  @ingroup LTC2480
69  Header for LTC2480: 16-Bit Delta-Sigma ADC with Easy Drive Input Current Cancellation.
70 */
71 
72 #ifndef LTC2480_H
73 #define LTC2480_H
74 
75 //! Define the SPI CS pin
76 #ifndef LTC2480_CS
77 #define LTC2480_CS QUIKEVAL_CS
78 #endif
79 
80 //! @name LTC480 Input Gain
81 //! @{
82 // Input Gain
83 #define LTC2480_GAIN_1 0x00
84 #define LTC2480_GAIN_4 0x10
85 #define LTC2480_GAIN_8 0x20
86 #define LTC2480_GAIN_16 0x30
87 #define LTC2480_GAIN_32 0x40
88 #define LTC2480_GAIN_64 0x50
89 #define LTC2480_GAIN_128 0x60
90 #define LTC2480_GAIN_256 0x70
91 //!@}
92 
93 //! Function to set the input voltage gain and frequency rejection mode
94 //! @return void
95 void LTC2480_set_modes(uint8_t cs, //!< Chip Select Pin
96  uint8_t gain, //!< Input voltage gain
97  uint8_t rejection_mode); //!< Frequency rejection mode
98 
99 //! Reads the LTC2480 and returns 24-bit data
100 //! @return void
101 void LTC2480_read(uint8_t cs, //!< Chip Select Pin
102  uint32_t *ptr_adc_code //!< Returns code read from ADC (from previous conversion)
103  );
104 
105 //! Calculates the LTC2480 input voltage given the binary data, reference voltage and input gain.
106 //! @return Floating point voltage
107 float LTC2480_code_to_voltage(uint32_t adc_code, //!< Raw ADC code
108  float vref, //!< Reference voltage
109  uint8_t gain //!< Input voltage gain
110  );
111 
112 
113 #endif // LTC2480_H
static uint8_t rejection_mode
The LTC2498 rejection mode settings.
void LTC2480_set_modes(uint8_t cs, uint8_t gain, uint8_t rejection_mode)
Function to set the input voltage gain and frequency rejection mode.
Definition: LTC2480.cpp:69
float LTC2480_code_to_voltage(uint32_t adc_code, float vref, uint8_t gain)
Calculates the LTC2480 input voltage given the binary data, reference voltage and input gain...
Definition: LTC2480.cpp:90
void LTC2480_read(uint8_t cs, uint32_t *ptr_adc_code)
Reads the LTC2480 and returns 24-bit data.
Definition: LTC2480.cpp:78
static uint32_t adc_code
Definition: DC2071AA.ino:113