Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2600.h
Go to the documentation of this file.
1 /*!
2 LTC2600: Octal 16-Bit Rail-to-Rail DACs in 16-Lead SSOP
3 
4 @verbatim
5 
6 The LTC2600/LTC2610/LTC2620 are octal 16-, 14- and 12-bit, 2.5V-to-5.5V
7 rail-to-rail voltage-output DACs in 16-lead narrow SSOP and 20-lead 4mm × 5mm
8 QFN packages. They have built-in high performance output buffers and are
9 guaranteed monotonic.
10 
11 These parts establish advanced performance standards for output drive,
12 crosstalk and load regulation in single-supply, voltage output multiples.
13 
14 SPI DATA FORMAT (MSB First):
15 
16 24-Bit Load Sequence:
17 
18  Byte #1 Byte #2 Byte #3
19  Command MSB LSB
20 LTC2600-16 : C3 C2 C1 C0 A3 A2 A1 A0 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
21 LTC2610-14 : C3 C2 C1 C0 A3 A2 A1 A0 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 X X
22 LTC2620-12 : C3 C2 C1 C0 A3 A2 A1 A0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 X X X X
23 
24 32-Bit Load Sequence:
25 
26  Byte #1 Byte #2 Byte #3 Byte #4
27  Command MSB LSB
28 LTC2600-16 : X X X X X X X X C3 C2 C1 C0 A3 A2 A1 A0 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
29 LTC2610-14 : X X X X X X X X C3 C2 C1 C0 A3 A2 A1 A0 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 X X
30 LTC2620-12 : X X X X X X X X C3 C2 C1 C0 A3 A2 A1 A0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 X X X X
31 
32 Cx : DAC Command Code
33 Ax : DAC Address (0=DACA, 1=DACB, 2=DACC, 3=DACD, 0xFF=All DACs)
34 Dx : DAC Data Bits
35 X : Don't care
36 
37 
38 Example Code:
39 
40 Set DAC A to to 2V for 16-bit DAC.
41 
42  shift_count = 0; // 16-bit DAC does not have to be shifted
43  dac_voltage = 2.0; // Sets dac voltage variable to 2v
44 
45  dac_code = LTC2600_voltage_to_code(dac_voltage, LTC2600_lsb, LTC2600_offset); // Calculate DAC code from voltage, lsb, and offset
46  LTC2600_write(LTC2600_CS, LTC2600_CMD_WRITE_UPDATE, LTC2600_DAC_A, dac_code << shift_count); // Set DAC A with DAC code
47 
48 @endverbatim
49 
50 
51 http://www.linear.com/product/LTC2600
52 
53 http://www.linear.com/product/LTC2600#demoboards
54 
55 
56 
57 Copyright 2018(c) Analog Devices, Inc.
58 
59 All rights reserved.
60 
61 Redistribution and use in source and binary forms, with or without
62 modification, are permitted provided that the following conditions are met:
63  - Redistributions of source code must retain the above copyright
64  notice, this list of conditions and the following disclaimer.
65  - Redistributions in binary form must reproduce the above copyright
66  notice, this list of conditions and the following disclaimer in
67  the documentation and/or other materials provided with the
68  distribution.
69  - Neither the name of Analog Devices, Inc. nor the names of its
70  contributors may be used to endorse or promote products derived
71  from this software without specific prior written permission.
72  - The use of this software may or may not infringe the patent rights
73  of one or more patent holders. This license does not release you
74  from the requirement that you obtain separate licenses from these
75  patent holders to use this software.
76  - Use of the software either in source or binary form, must be run
77  on or directly connected to an Analog Devices Inc. component.
78 
79 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
80 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
81 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
82 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
83 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
84 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
85 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
86 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
87 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
88 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
89 */
90 
91 /*! @file
92  @ingroup LTC2600
93  Header for LTC2600: Octal 16-Bit Rail-to-Rail DACs in 16-Lead SSOP
94 */
95 
96 
97 #ifndef LTC2600_H
98 #define LTC2600_H
99 
100 #include <SPI.h>
101 
102 //! Define the SPI CS pin
103 #ifndef LTC2600_CS
104 #define LTC2600_CS QUIKEVAL_CS
105 #endif
106 
107 
108 //! @name LTC2600 Command Codes
109 //!@{
110 //! OR'd together with the DAC address to form the command byte
111 #define LTC2600_CMD_WRITE 0x00 //!< Write to input register n
112 #define LTC2600_CMD_UPDATE 0x10 //!< Update (power up) DAC register n
113 #define LTC2600_CMD_WRITE_UPDATE_ALL 0x20 //!< Write to input register n, update (power up) all
114 #define LTC2600_CMD_WRITE_UPDATE 0x30 //!< Write to input register n, update (power up) all
115 #define LTC2600_CMD_POWER_DOWN 0x40 //!< Power down n
116 #define LTC2600_CMD_NO_OPERATION 0xF0 //!< No operation
117 //!@}
118 
119 /*!
120 | DAC Addresses | Value |
121 | :--------------------------: | :------: |
122 | LTC2605_DAC_A | 0x00 |
123 | LTC2605_DAC_B | 0x01 |
124 | LTC2605_DAC_C | 0x02 |
125 | LTC2605_DAC_D | 0x03 |
126 | LTC2605_DAC_E | 0x04 |
127 | LTC2605_DAC_F | 0x05 |
128 | LTC2605_DAC_G | 0x06 |
129 | LTC2605_DAC_H | 0x07 |
130 | LTC2605_DAC_ALL | 0x0F |
131 */
132 /*! @name Dac Addresses
133 @{*/
134 
135 // Which DAC to operate on
136 #define LTC2600_DAC_A 0x00
137 #define LTC2600_DAC_B 0x01
138 #define LTC2600_DAC_C 0x02
139 #define LTC2600_DAC_D 0x03
140 #define LTC2600_DAC_E 0x04
141 #define LTC2600_DAC_F 0x05
142 #define LTC2600_DAC_G 0x06
143 #define LTC2600_DAC_H 0x07
144 #define LTC2600_DAC_ALL 0x0F
145 //
146 
147 //! Write the 16-bit dac_code to the LTC2600
148 //! @return Void
149 void LTC2600_write(uint8_t cs, //!< Chip Select Pin
150  uint8_t dac_command, //!< Command Nibble, left-justified, lower nibble set to zero
151  uint8_t dac_address, //!< DAC Address Nibble, right justified, upper nibble set to zero
152  uint16_t dac_code //!< 16-bit DAC code
153  );
154 
155 //! Calculate a LTC2600 DAC code given the desired output voltage and DAC address (0-3)
156 //! @return The 16-bit code to send to the DAC
157 uint16_t LTC2600_voltage_to_code(float dac_voltage, //!< Voltage to send to DAC
158  float LTC2600_lsb, //!< LSB value (volts)
159  int16_t LTC2600_offset //!< Offset (volts)
160  );
161 
162 //! Calculate the LTC2600 DAC output voltage given the DAC code, offset, and LSB value
163 //! @return Calculated voltage
164 float LTC2600_code_to_voltage(uint16_t dac_code, //!< DAC code
165  float LTC2600_lsb, //!< LSB value (volts)
166  int16_t LTC2600_offset //!< Offset (volts)
167  );
168 
169 #endif //LTC2600_H
void LTC2600_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write the 16-bit dac_code to the LTC2600.
Definition: LTC2600.cpp:75
static int16_t LTC2600_offset
Definition: DC579A.ino:90
float LTC2600_code_to_voltage(uint16_t dac_code, float LTC2600_lsb, int16_t LTC2600_offset)
Calculate the LTC2600 DAC output voltage given the DAC code, offset, and LSB value.
Definition: LTC2600.cpp:103
static float LTC2600_lsb
Definition: DC579A.ino:91
uint16_t LTC2600_voltage_to_code(float dac_voltage, float LTC2600_lsb, int16_t LTC2600_offset)
Calculate a LTC2600 DAC code given the desired output voltage and DAC address (0-3) ...
Definition: LTC2600.cpp:90