| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2473.h
Go to the documentation of this file.
1 /*!
2 LTC2473: 16-Bit, Delta Sigma ADC with I2C interface.
3
4 @verbatim
5
6 The LTC2471/LTC2473 are small, 16-bit analog-to-digital converters with an
7 integrated precision reference and a selectable 208sps or 833sps output
8 rate. They use a single 2.7V to 5.5V supply and communicate through an I2C
9 Interface. The LTC2471 is single-ended with a 0V to VREF input range and
10 the LTC2473 is differential with a +-VREF input range. Both ADC's include
11 a 1.25V integrated reference with 2ppm/C drift performance and 0.1% initial
12 accuracy. They include an integrated oscillator and perform conversions with
13 no latency for multiplexed applications. The LTC2471/LTC2473 include a
14 proprietary input sampling scheme that reduces the average input current
15 several orders of magnitude when compared to conventional delta sigma
16 converters.
17
18 I2C DATA FORMAT (MSB FIRST);
19
20 Data Out:
21 Byte #1 Byte #2
22 MSB
23 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK REPEAT START D15 D14 D13 D12 D11 D10 D9 D8 MACK
24
25 Byte #3
26 LSB
27 D7 D6 D5 D4 D3 D2 D1 D0 MNACK STOP
28
29 Data In:
30 Byte #1 Byte #2
31 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK C3 C2 C1 C0 X X X X SACK STOP
32
33
34 START : I2C Start
35 REPEAT Start : I2C Repeat Start
36 STOP : I2C Stop
37 SACK : I2C Slave Generated Acknowledge (Active Low)
38 MACK : I2C Master Generated Acknowledge (Active Low)
39 MNACK : I2C Master Generated Not Acknowledge
40 SAx : I2C Address
41 W : I2C Write (0)
42 R : I2C Read (1)
43 Cx : Command Code
44 Dx : Data Bits
45 X : Don't care
46
47 Example Code:
48
49 Read LTC2473:
50 uint8_t acknowledge;
51 int32_t adc_code = 0;
52 uint16_t timeout = 300; // timeout in microseconds
53 float adc_voltage;
54 acknowledge = LTC2473_read(i2c_address, &adc_code, timeout);
55
56 // Convert adc_code to voltage
57 adc_voltage = LTC2473_code_to_voltage(adc_code, LTC2473_lsb, LTC2473_offset_code);
58
59 @endverbatim
60
61 http://www.linear.com/product/LTC2473
62
63 http://www.linear.com/product/LTC2473#demoboards
64
65
66 Copyright 2018(c) Analog Devices, Inc.
67
68 All rights reserved.
69
70 Redistribution and use in source and binary forms, with or without
71 modification, are permitted provided that the following conditions are met:
72 - Redistributions of source code must retain the above copyright
73 notice, this list of conditions and the following disclaimer.
74 - Redistributions in binary form must reproduce the above copyright
75 notice, this list of conditions and the following disclaimer in
76 the documentation and/or other materials provided with the
77 distribution.
78 - Neither the name of Analog Devices, Inc. nor the names of its
79 contributors may be used to endorse or promote products derived
80 from this software without specific prior written permission.
81 - The use of this software may or may not infringe the patent rights
82 of one or more patent holders. This license does not release you
83 from the requirement that you obtain separate licenses from these
84 patent holders to use this software.
85 - Use of the software either in source or binary form, must be run
86 on or directly connected to an Analog Devices Inc. component.
87
88 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
89 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
90 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
91 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
92 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
93 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
94 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
95 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
96 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
97 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
98 */
99
100 /*! @file
101 @ingroup LTC2473
102 Header for LTC2473: 16-Bit, Delta Sigma ADC with I2C interface
103 */
104
105 #ifndef LTC2473_H
106 #define LTC2473_H
107
108 /*! @name I2C_Addresses
109 @{ */
110
111 //! I2C address of the LTC2473.
112 //! Configured by tying the ADR0 pin high or low. See datasheet for details.
113 //! Uncomment LTC2473_I2C_ADDRESS to match demo board configuration.
114 // Address assignment
115 // LTC2473 I2C Address // AD0
116 #define LTC2473_I2C_ADDRESS 0x14 // Low
117 //#define LTC2473_I2C_ADDRESS 0x54 // High
118 /*!
119 @}
120 */
121
122 /*! @name Mode Configuration
123 @{
124 */
125 #define LTC2473_ENABLE_PROGRAMMING 0x80
126 #define LTC2473_SPS_208 0x00
127 #define LTC2473_SPS_833 0x20
128 #define LTC2473_SLEEP 0x10
129 /*!
130 @}
131 */
132
133 /*Commands
134 Construct a control word by bitwise ORing one choice from the configuration
135 and the enable programming.
136
137 Example - Set the LTC2473 to 833 samples per second.
138 ack = LTC2473_write(i2c_address, LTC2473_ENABLE_PROGRAMMING | LTC2473_SPS_833);
139 */
140
141 //! Reads from LTC2473.
142 //! @return 1 if no acknowledge, 0 if acknowledge
143 uint8_t LTC2473_read(uint8_t i2c_address, //!< I2C address (7-bit format) for part
144 int32_t *adc_code, //!< 2 byte conversion code read from LTC2473
145 uint16_t timeout //!< The timeout in (microseconds)
146 );
147
148 //! Writes to the LTC2473
149 //! @return 1 if no acknowledge, 0 if acknowledge
150 uint8_t LTC2473_write(uint8_t i2c_address, //!< I2C address (7-bit format) for part
151 uint8_t adc_command //!< Command byte written to LTC2473
152 );
153
154 //! Calculates the voltage corresponding to an ADC code, given the reference (in volts)
155 //! @return Returns voltage calculated from ADC code.
156 float LTC2473_code_to_voltage(int32_t adc_code, //!< Code read from adc
157 float vref //!< VRef (in volts)
158 );
159
160 #endif // LTC2473_H
LTC2473_read
uint8_t LTC2473_read(uint8_t i2c_address, int32_t *adc_code, uint16_t timeout)
Reads from LTC2473.
Definition: LTC2473.cpp:77
i2c_address
uint8_t i2c_address
adc_command
static uint8_t adc_command
Definition: DC2071AA.ino:111
LTC2473_code_to_voltage
float LTC2473_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference (in volts) ...
Definition: LTC2473.cpp:94
LTC2473_write
uint8_t LTC2473_write(uint8_t i2c_address, uint8_t adc_command)
Writes to the LTC2473.
Definition: LTC2473.cpp:85
timeout
long timeout
Definition: EVAL-AD7124-8.ino:144
vref
float vref
Definition: LTC2492_Thermocouple_Meter.ino:129
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113