| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2607.h
Go to the documentation of this file.
1 /*!
2 LTC2607: 16-Bit, Dual Rail-to-Rail DACs with I2C Interface.
3 LTC2609: Quad 16-/14-/12-Bit Rail-to-Rail DACs with I²C Interface.
4 LTC2606: 16-Bit Rail-to-Rail DACs with I²C Interface.
5
6 @verbatim
7
8 The LTC2607/LTC2617/LTC2627 are dual 16-, 14- and 12-bit, 2.7V to 5.5V
9 rail-to-rail voltage output DACs in a 12-lead DFN package. They have built-in
10 high performance output buffers and are guaranteed monotonic.
11
12 These parts establish new board-density benchmarks for 16- and 14-bit DACs and
13 advance performance standards for output drive and load regulation in single-
14 supply, voltage-output DACs.
15
16 The parts use a 2-wire, I2C compatible serial interface. The
17 LTC2607/LTC2617/LTC2627 operate in both the standard mode (clock rate of 100kHz)
18 and the fast mode (clock rate of 400kHz). An asynchronous DAC update pin (LDAC)
19 is also included.
20
21 The LTC2607/LTC2617/LTC2627 incorporate a power-on reset circuit. During power-
22 up, the voltage outputs rise less than 10mV above zero scale; and after power-
23 up, they stay at zero scale until a valid write and update take place. The
24 power-on reset circuit resets the LTC2607-1/LTC2617-1/ LTC2627-1 to mid-scale.
25 The voltage outputs stay at midscale until a valid write and update takes place.
26
27 I2C DATA FORMAT (MSB First):
28
29 Byte #1 Byte #2 Byte #3 Byte #4
30
31 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK C3 C2 C1 C0 A3 A2 A1 A0 SACK D15 D14 D13 D12 D11 D10 D9 D8 SACK D7 D6 D5 D4 D3 D2 D1 D0 SACK STOP
32
33 SACK : Slave Acknowlege
34 SAx : I2C Address
35 W : I2C Write (0)
36 R : I2C Read (1)
37 SACK : I2C Slave Generated Acknowledge (Active Low)
38 Cx : DAC Command Code
39 Ax : DAC Address
40 Dx : DAC Data Bits
41 X : Don't care
42
43
44 Example Code:
45
46 Set DAC A to Full Scale.
47
48 dac_code = 0x0FFFF; // Set dac code to full scale
49
50 // Write dac code to the LTC2607 and update dac
51 ack = LTC2607_write(LTC2607_I2C_GLOBAL_ADDRESS, LTC2607_WRITE_UPDATE_COMMAND, LTC2607_DAC_A, dac_code);
52
53 @endverbatim
54
55 http://www.linear.com/product/LTC2607
56 http://www.linear.com/product/LTC2609
57 http://www.linear.com/product/LTC2606
58
59 http://www.linear.com/product/LTC2607#demoboards
60 http://www.linear.com/product/LTC2609#demoboards
61 http://www.linear.com/product/LTC2606#demoboards
62
63
64 Copyright 2018(c) Analog Devices, Inc.
65
66 All rights reserved.
67
68 Redistribution and use in source and binary forms, with or without
69 modification, are permitted provided that the following conditions are met:
70 - Redistributions of source code must retain the above copyright
71 notice, this list of conditions and the following disclaimer.
72 - Redistributions in binary form must reproduce the above copyright
73 notice, this list of conditions and the following disclaimer in
74 the documentation and/or other materials provided with the
75 distribution.
76 - Neither the name of Analog Devices, Inc. nor the names of its
77 contributors may be used to endorse or promote products derived
78 from this software without specific prior written permission.
79 - The use of this software may or may not infringe the patent rights
80 of one or more patent holders. This license does not release you
81 from the requirement that you obtain separate licenses from these
82 patent holders to use this software.
83 - Use of the software either in source or binary form, must be run
84 on or directly connected to an Analog Devices Inc. component.
85
86 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
87 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
88 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
89 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
90 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
91 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
92 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
93 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
94 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
95 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
96 */
97
98 /*! @file
99 @ingroup LTC2607
100 Header File for LTC2607: 16-Bit, Dual Rail-to-Rail DACs with I2C Interface
101 */
102
103 #ifndef LTC2607_H
104 #define LTC2607_H
105
106 #include <Wire.h>
107
108 /*! @name I2C_Addresses
109 @{ */
110
111 //! I2C address of the LTC2607.
112 //! Configured with the CA0, CA1, and CA2 pins. See Table 1 of datasheet.
113 //! Uncomment LTC2607_I2C_ADDRESS to match demo board configuration.
114 // Address assignment
115 // LTC2607 I2C Address // AD2 AD1 AD0
116 #define LTC2607_I2C_ADDRESS 0x10 // LOW LOW LOW
117 // #define LTC2607_I2C_ADDRESS 0x11 // LOW LOW Float
118 // #define LTC2607_I2C_ADDRESS 0x12 // LOW LOW HIGH
119 // #define LTC2607_I2C_ADDRESS 0x13 // LOW Float LOW
120 // #define LTC2607_I2C_ADDRESS 0x20 // LOW Float Float
121 // #define LTC2607_I2C_ADDRESS 0x21 // LOW Float High
122 // #define LTC2607_I2C_ADDRESS 0x22 // LOW HIGH LOW
123 // #define LTC2607_I2C_ADDRESS 0x23 // LOW HIGH Float
124 // #define LTC2607_I2C_ADDRESS 0x30 // LOW High HIGH
125 // #define LTC2607_I2C_ADDRESS 0x31 // Float LOW LOW
126 // #define LTC2607_I2C_ADDRESS 0x32 // Float LOW Float
127 // #define LTC2607_I2C_ADDRESS 0x33 // Float LOW HIGH
128 // #define LTC2607_I2C_ADDRESS 0x40 // Float Float LOW
129 // #define LTC2607_I2C_ADDRESS 0x41 // Float Float Float
130 // #define LTC2607_I2C_ADDRESS 0x42 // Float Float HIGH
131 // #define LTC2607_I2C_ADDRESS 0x43 // Float High LOW
132 // #define LTC2607_I2C_ADDRESS 0x50 // Float High Float
133 // #define LTC2607_I2C_ADDRESS 0x51 // Float High HIGH
134 // #define LTC2607_I2C_ADDRESS 0x52 // High LOW LOW
135 // #define LTC2607_I2C_ADDRESS 0x53 // High LOW Float
136 // #define LTC2607_I2C_ADDRESS 0x60 // High LOW High
137 // #define LTC2607_I2C_ADDRESS 0x61 // High Float LOW
138 // #define LTC2607_I2C_ADDRESS 0x62 // High Float Float
139 // #define LTC2607_I2C_ADDRESS 0x63 // High Float High
140 // #define LTC2607_I2C_ADDRESS 0x70 // High High LOW
141 // #define LTC2607_I2C_ADDRESS 0x71 // High High Float
142 // #define LTC2607_I2C_ADDRESS 0x72 // High High High
143
144 //! LTC2607 Global I2C Address.
145 #define LTC2607_I2C_GLOBAL_ADDRESS 0x73 // Global Address
146
147 /*! @} */
148 /*! @name DAC Command
149 @{ */
150
151 #define LTC2607_WRITE_COMMAND 0x00 //!< Command to write to internal register of LTC2607, but not update output voltage yet.
152 #define LTC2607_UPDATE_COMMAND 0x10 //!< Command to update (and power up) LTC2607. Output voltage will be set to the value stored in the internal register by previous write command.
153 #define LTC2607_WRITE_UPDATE_COMMAND 0x30 //!< Command to write and update (and power up) the LTC2607. The output voltage will immediate change to the value being written to the internal register.
154 #define LTC2607_POWER_DOWN_COMMAND 0x40 //!< Command to power down the LTC2607.
155
156 /*! @} */
157 /*! @name DAC Address
158 @{ */
159
160 // DAC Address
161 #define LTC2607_DAC_A 0x00 //!< Command (and DAC code) will modify DAC A
162 #define LTC2607_DAC_B 0x01 //!< Command (and DAC code) will modify DAC B
163 #define LTC2607_ALL_DACS 0x0F //!< Command (and DAC code) will modify both DAC A and DAC B
164
165 /*! @} */
166
167 const float LTC2607_TYPICAL_lsb = 7.6295109E-5; //!< The LTC2607 typical least significant bit value with 5V full-scale
168 const float LTC2607_TYPICAL_OFFSET = 0; //!< The LTC2607 typical offset voltage
169
170 //! Writes command, DAC address, and DAC code to the LTC2607.
171 //! Configures command (write, update, power down, etc.), address (DAC A, DAC B, or BOTH), and 16-bit dac_code for output voltage.
172 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
173 int8_t LTC2607_write(uint8_t i2c_address, //!< I2C address of the LTC2607. Configured by CA0, CA1, and CA2 pins. See Table 1 of datasheet.
174 uint8_t dac_command, //!< DAC command (4-bits) that will be written to LTC2607. (Write, update, power down, etc.)
175 uint8_t dac_address, //!< DAC address (4-bits) that will be written to LTC2607. Configures DAC A, DAC B, or both.
176 uint16_t dac_code //!< DAC code that will be written to LTC2607. This configures the output voltage.
177 );
178
179 //! Calculates an LTC2607 DAC code for the desired output voltage.
180 //! Based on the desired output voltage, the offset, and lsb parameters, return the corresponding DAC code that should be written to the LTC2607.
181 //! @return DAC code for desired output voltage
182 uint16_t LTC2607_voltage_to_code(float dac_voltage, //!< Desired DAC output voltage.
183 float LTC2607_lsb, //!< The LSB weight. Use calibrated value for best results, otherwise use typical value from datasheet.
184 int32_t LTC2607_offset //!< The offset voltage. Use calibrated value for best results, otherwise use typical value from datasheet.
185 );
186
187 //! Calculates the LTC2607 offset and lsb voltage given two measured voltages and their corresponding DAC codes.
188 //! Prior to calling this function, write two DAC codes to the LTC2607, and measure the output voltage for each DAC code.
189 //! When passed the DAC codes and measured voltages as parameters, this function calculates the calibrated lsb and offset values.
190 void LTC2607_calibrate(uint16_t dac_code1, //!< DAC Code 1.
191 uint16_t dac_code2, //!< DAC Code 2.
192 float voltage1, //!< Measured output voltage corresponding to DAC Code 1.
193 float voltage2, //!< Measured output voltage corresponding to DAC Code 2.
194 float *LTC2607_lsb, //!< Overwritten with new calculated lsb voltage.
195 int32_t *LTC2607_offset //!< Overwritten with new calculated offset voltage.
196 );
197
198 #endif // LTC2607_H
LTC2607_offset
static int32_t LTC2607_offset[3]
The LTC2422 offset variable.
Definition: DC934A.ino:139
i2c_address
uint8_t i2c_address
LTC2607_calibrate
void LTC2607_calibrate(uint16_t dac_code1, uint16_t dac_code2, float voltage1, float voltage2, float *LTC2607_lsb, int32_t *LTC2607_offset)
Calculates the LTC2607 offset and lsb voltage given two measured voltages and their corresponding DAC...
Definition: LTC2607.cpp:127
LTC2607_TYPICAL_OFFSET
const float LTC2607_TYPICAL_OFFSET
The LTC2607 typical offset voltage.
Definition: LTC2607.h:168
LTC2607_lsb
static float LTC2607_lsb[3]
The LTC2607 least significant bit value with 5V full-scale.
Definition: DC934A.ino:131
LTC2607_TYPICAL_lsb
const float LTC2607_TYPICAL_lsb
The LTC2607 typical least significant bit value with 5V full-scale.
Definition: LTC2607.h:167
LTC2607_voltage_to_code
uint16_t LTC2607_voltage_to_code(float dac_voltage, float LTC2607_lsb, int32_t LTC2607_offset)
Calculates an LTC2607 DAC code for the desired output voltage.
Definition: LTC2607.cpp:110
LTC2607_write
int8_t LTC2607_write(uint8_t i2c_address, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Writes command, DAC address, and DAC code to the LTC2607.
Definition: LTC2607.cpp:100