Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC2668.h
Go to the documentation of this file.
1 /*!
2 LTC2668: 16-Channel SPI 16-/12-Bit +/-10V Vout SoftSpan DACs with 10ppm/C Max Reference.
3 
4 @verbatim
5 
6 The LTC2668 is a family of 16-channel, 12/16-bit +/-10V digital-to-analog converters with integrated
7 precision references. They are guaranteed monotonic and have built-in rail-to-rail output buffers.
8 These SoftSpan DACs offer five output ranges up to +/-10V. The range of each channel is independently
9 programmable, or the part can be hardware-configured for operation in a fixed range.
10 
11 The integrated 2.5V reference is buffered separately to each channel; an external reference can be used
12 for additional range options. The LTC2668 also includes toggle capability - alternating codes via the
13 software toggle command, or by providing a free-running clock to the TGP pin.
14 
15 The SPI/Microwire-compatible 3-wire serial interface operates on logic levels as low as 1.71V, at clock
16 rates up to 50MHz.
17 
18 
19  SPI DATA FORMAT (MSB First):
20 
21  24-Bit Load Sequence:
22 
23  Byte #1 Byte #2 Byte #3
24  Command MSB LSB
25  LTC2668-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
26  LTC2668-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
27 
28  32-Bit Load Sequence:
29  Byte #1 Byte #2 Byte #3 Byte #4
30  Command MSB LSB
31  LTC2668-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
32  LTC2668-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
33 
34  Cx : DAC Command Code
35  Ax : DAC Address (0 to F, corresponding to DAC 0 to DAC 15)
36  Dx : DAC Data Bits
37  X : Don't care
38 
39 @endverbatim
40 
41 http://www.linear.com/product/LTC2668
42 
43 http://www.linear.com/product/LTC2668#demoboards
44 
45 
46 Copyright 2018(c) Analog Devices, Inc.
47 
48 All rights reserved.
49 
50 Redistribution and use in source and binary forms, with or without
51 modification, are permitted provided that the following conditions are met:
52  - Redistributions of source code must retain the above copyright
53  notice, this list of conditions and the following disclaimer.
54  - Redistributions in binary form must reproduce the above copyright
55  notice, this list of conditions and the following disclaimer in
56  the documentation and/or other materials provided with the
57  distribution.
58  - Neither the name of Analog Devices, Inc. nor the names of its
59  contributors may be used to endorse or promote products derived
60  from this software without specific prior written permission.
61  - The use of this software may or may not infringe the patent rights
62  of one or more patent holders. This license does not release you
63  from the requirement that you obtain separate licenses from these
64  patent holders to use this software.
65  - Use of the software either in source or binary form, must be run
66  on or directly connected to an Analog Devices Inc. component.
67 
68 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
69 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
70 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
71 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
72 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
73 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
74 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
75 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
76 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
77 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78 */
79 
80 /*! @file
81  @ingroup LTC2668
82  Header for LTC2668: 16-Channel SPI 16-/12-Bit +/-10V Vout SoftSpan DACs with 10ppm/C Max Reference
83 */
84 
85 #ifndef LTC2668_H
86 #define LTC2668_H
87 
88 //! Define the SPI CS pin
89 #ifndef LTC2668_CS
90 #define LTC2668_CS QUIKEVAL_CS //! SPI Chip Select Pin
91 #endif
92 
93 //! @name LTC2668 Command Codes
94 //! OR'd together with the DAC address to form the command byte
95 #define LTC2668_CMD_WRITE_N 0x00 //!< Write to input register n
96 #define LTC2668_CMD_UPDATE_N 0x10 //!< Update (power up) DAC register n
97 #define LTC2668_CMD_WRITE_N_UPDATE_ALL 0x20 //!< Write to input register n, update (power-up) all
98 #define LTC2668_CMD_WRITE_N_UPDATE_N 0x30 //!< Write to input register n, update (power-up)
99 #define LTC2668_CMD_POWER_DOWN_N 0x40 //!< Power down n
100 #define LTC2668_CMD_POWER_DOWN_ALL 0x50 //!< Power down chip (all DAC's, MUX and reference)
101 
102 #define LTC2668_CMD_SPAN 0x60 //!< Write span to dac n
103 #define LTC2668_CMD_CONFIG 0x70 //!< Configure reference / toggle
104 #define LTC2668_CMD_WRITE_ALL 0x80 //!< Write to all input registers
105 #define LTC2668_CMD_UPDATE_ALL 0x90 //!< Update all DACs
106 #define LTC2668_CMD_WRITE_ALL_UPDATE_ALL 0xA0 //!< Write to all input reg, update all DACs
107 #define LTC2668_CMD_MUX 0xB0 //!< Select MUX channel (controlled by 5 LSbs in data word)
108 #define LTC2668_CMD_TOGGLE_SEL 0xC0 //!< Select which DACs can be toggled (via toggle pin or global toggle bit)
109 #define LTC2668_CMD_GLOBAL_TOGGLE 0xD0 //!< Software toggle control via global toggle bit
110 #define LTC2668_CMD_SPAN_ALL 0xE0 //!< Set span for all DACs
111 #define LTC2668_CMD_NO_OPERATION 0xF0 //!< No operation
112 //! @}
113 
114 //! @name LTC2668 Span Codes
115 //! @{
116 //! Descriptions are valid for a 2.5V reference.
117 //! These can also be interpreted as 0 to 2*Vref, 0 to 4*Vref, etc.
118 //! when an external reference other than 2.5V is used.
119 #define LTC2668_SPAN_0_TO_5V 0x0000
120 #define LTC2668_SPAN_0_TO_10V 0x0001
121 #define LTC2668_SPAN_PLUS_MINUS_5V 0x0002
122 #define LTC2668_SPAN_PLUS_MINUS_10V 0x0003
123 #define LTC2668_SPAN_PLUS_MINUS_2V5 0x0004
124 //! @}
125 
126 //! @name LTC2668 Minimums and Maximums for each Span
127 //! @{
128 //! Lookup tables for minimum and maximum outputs for a given span
129 const float LTC2668_MIN_OUTPUT[5] = {0.0, 0.0, -5.0, -10.0, -2.5};
130 const float LTC2668_MAX_OUTPUT[5] = {5.0, 10.0, 5.0, 10.0, 2.5};
131 //! @}
132 
133 //! @name LTC2668 Configuration options
134 //! @{
135 //! Used in conjunction with LTC2668_CMD_CONFIG command
136 #define LTC2668_REF_DISABLE 0x0001 //! Disable internal reference to save power when using an ext. ref.
137 #define LTC2668_THERMAL_SHUTDOWN 0x0002 //! Disable thermal shutdown (NOT recommended)
138 //! @}
139 
140 //! @name LTC2668 MUX enable
141 //! @{
142 //! Used in conjunction with LTC2668_CMD_MUX command
143 #define LTC2668_MUX_DISABLE 0x0000 //! Disable MUX
144 #define LTC2668_MUX_ENABLE 0x0010 //! Enable MUX, OR with MUX channel to be monitored
145 //! @}
146 
147 //! @name LTC2668 Global Toggle
148 //! @{
149 //! Used in conjunction with LTC2668_CMD_GLOBAL_TOGGLE command, affects DACs whose
150 //! Toggle Select bits have been set to 1
151 #define LTC2668_TOGGLE_REG_A 0x0000 //! Update DAC with register A
152 #define LTC2668_TOGGLE_REG_B 0x0010 //! Update DAC with register B
153 //! @}
154 
155 //! Write the 16-bit dac_code to the LTC2668
156 //! @return Zero if readback (SDO) data matches the value previously sent, One if mismatched (indicating data error somewhere)
157 int8_t LTC2668_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code);
158 
159 //! Calculate a LTC2668 DAC code given the desired output voltage and DAC address (0-3)
160 //! @return The 16 bit code to send to the DAC
161 uint16_t LTC2668_voltage_to_code(float dac_voltage, float min_output, float max_output);
162 
163 //! Calculate the LTC2668 DAC output voltage given the DAC code, offset, and LSB
164 //! @return the output voltage
165 float LTC2668_code_to_voltage(uint16_t dac_code, float min_output, float max_output);
166 
167 #endif // LTC2668_H
const float LTC2668_MIN_OUTPUT[5]
Definition: LTC2668.h:129
int8_t LTC2668_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write the 16-bit dac_code to the LTC2668.
Definition: LTC2668.cpp:70
const float LTC2668_MAX_OUTPUT[5]
Definition: LTC2668.h:130
uint16_t LTC2668_voltage_to_code(float dac_voltage, float min_output, float max_output)
Calculate a LTC2668 DAC code given the desired output voltage and DAC address (0-3) ...
Definition: LTC2668.cpp:103
float LTC2668_code_to_voltage(uint16_t dac_code, float min_output, float max_output)
Calculate the LTC2668 DAC output voltage given the DAC code, offset, and LSB.
Definition: LTC2668.cpp:117