| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2485.h
Go to the documentation of this file.
1 /*!
2 LTC2485: 24-Bit Delta Sigma ADC with Easy Drive Input Current Cancellation and
3 I2C Interface
4
5 @verbatim
6
7 The LTC2485 combines a 24-bit plus sign No Latency Delta Sigma analog-to-digital
8 converter with patented Easy Drive technology and I2C digital interface. The
9 patented sampling scheme eliminates dynamic input current errors and the
10 shortcomings of on-chip buffering through automatic cancellation of differential
11 input current. This allows large external source impedances and input signals,
12 with rail-to-rail input range to be directly digitized while maintaining
13 exceptional DC accuracy.
14
15 Example Code:
16
17 Read input with 1X speed mode and rejection frequency of 60Hz
18
19 adc_command = LTC2485_R60 | LTC2485_SPEED_1X; // Set to 1X mode with 60hz rejection
20 ack |= LTC2485_read(i2c_address, adc_command, &adc_code); // Throws out last reading
21 ack |= LTC2485_read(i2c_address, adc_command, &adc_code); // Obtains the current reading and stores to adc_code variable
22
23 @endverbatim
24
25 http://www.linear.com/product/LTC2485
26
27 http://www.linear.com/product/LTC2485#demoboards
28
29
30 Copyright 2018(c) Analog Devices, Inc.
31
32 All rights reserved.
33
34 Redistribution and use in source and binary forms, with or without
35 modification, are permitted provided that the following conditions are met:
36 - Redistributions of source code must retain the above copyright
37 notice, this list of conditions and the following disclaimer.
38 - Redistributions in binary form must reproduce the above copyright
39 notice, this list of conditions and the following disclaimer in
40 the documentation and/or other materials provided with the
41 distribution.
42 - Neither the name of Analog Devices, Inc. nor the names of its
43 contributors may be used to endorse or promote products derived
44 from this software without specific prior written permission.
45 - The use of this software may or may not infringe the patent rights
46 of one or more patent holders. This license does not release you
47 from the requirement that you obtain separate licenses from these
48 patent holders to use this software.
49 - Use of the software either in source or binary form, must be run
50 on or directly connected to an Analog Devices Inc. component.
51
52 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
53 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
54 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
56 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
58 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63
64 /*! @file
65 @ingroup LTC2485
66 Header for LTC2485: 24-Bit Delta Sigma ADC with Easy Drive Input Current Cancellation and I2C Interface
67 */
68
69 #ifndef LTC2485_H
70 #define LTC2485_H
71
72 #include "Linduino.h"
73
74 /*! @name I2C_Addresses
75 @{ */
76
77 //! I2C address of the LTC2485.
78 //! Configured by tying the CA1 and CA0 pins high, low, or left floating. See Table 4 of datasheet.
79 //! Uncomment LTC2485_I2C_ADDRESS to match demo board configuration.
80 // Address assignment
81 // LTC2485 I2C Address // CA1 CA0
82 // #define LTC2485_I2C_ADDRESS 0b0010100 // Low High
83 // #define LTC2485_I2C_ADDRESS 0b0010101 // Low Float
84 // #define LTC2485_I2C_ADDRESS 0b0010111 // Float High
85 // #define LTC2485_I2C_ADDRESS 0b0100100 // Float Float
86 // #define LTC2485_I2C_ADDRESS 0b0100110 // High High
87 // #define LTC2485_I2C_ADDRESS 0b0100111 // High Float
88
89 //! LTC2485 Global I2C Address.
90 #define LTC2485_I2C_GLOBAL_ADDRESS 0b1110111 // Global Address
91 /*! @} */
92
93 /*! @name Mode Configuration
94 @{
95 See Table 1 of datasheet.
96 */
97 #define LTC2485_SPEED_1X 0x00
98 #define LTC2485_SPEED_2X 0x01
99 #define LTC2485_INTERNAL_TEMP 0x08
100
101 // Select rejection frequency - 50 and 60, 50, or 60Hz
102 #define LTC2485_R50 0x02
103 #define LTC2485_R60 0x04
104 #define LTC2485_R50_R60 0x00
105 /*!
106 @}
107 */
108
109 /*Commands
110 Construct the control word by bitwise ORing the MODE configuration options.
111 See Table 1 of datasheet. (C3,C2,C1,C1=X11X is reserved.)
112
113 Example - reject 60Hz with 2X mode enabled.
114 adc_command = (LTC2485_R60 | LTC2485_SPEED_2X);
115 */
116
117 //! Reads from LTC2485 ADC that accepts an 8 bit configuration and returns a 24 bit result.
118 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
119 int8_t LTC2485_read(uint8_t i2c_address, //!< I2C address (7-bit format) for part
120 uint8_t adc_command, //!< Command byte written to LTC2485. Example: (LTC2485_R60 | LTC2485_SPEED_2X)
121 int32_t *adc_code, //!< Conversion code read from LTC2485. The LTC2485's 32-bit code is converted to 24-bits inside this function.
122 uint16_t eoc_timeout //!< Timeout in ms
123 );
124
125 #endif // LTC2485_H
i2c_address
uint8_t i2c_address
adc_command
static uint8_t adc_command
Definition: DC2071AA.ino:111
Linduino.h
Header File for Linduino Libraries and Demo Code.
eoc_timeout
static uint16_t eoc_timeout
timeout in ms
Definition: LTC2492_Panel_Meter.ino:135
LTC2485_read
int8_t LTC2485_read(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC2485 ADC that accepts an 8 bit configuration and returns a 24 bit result.
Definition: LTC2485.cpp:70
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113