| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC1592.h
Go to the documentation of this file.
1 /*!
2 LTC1592: 16-bit SoftSpan DAC with Programmable Output Range
3
4 @verbatim
5
6 The LTC1592 is a 16-bit serial input DAC that operates on a single 5V supply.
7 It can be software-programmed for either unipolar or bipolar mode. It can
8 also be programmed for different output voltage ranges - two output ranges in
9 unipolar mode and four output ranges in bipolar mode.
10
11 The device includes an internal deglitcher circuit that reduces the glitch
12 impulse to less than 2nV-s (typ).
13
14 When the CS/LD is brought to a logic low, the data on the SDI input is loaded
15 into the shift register on the rising edge of the clock. A 4-bit command word
16 (C3 C2 C1 C0), followed by four “don’t care” bits and 16 data bits(MSB-first)
17 is the minimum loading sequence required. When the CS/LD is brought to a logic
18 high, the clock is disabled internally and the command word is executed.
19
20 SPI DIN FORMAT (MSB First):
21
22 Byte #1 Byte #2 Byte #3
23 C3 C2 C1 C0 X X X X D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
24
25 @endverbatim
26
27 http://www.linear.com/product/LTC1592
28
29 http://www.linear.com/product/LTC1592#demoboards
30
31 Copyright 2018(c) Analog Devices, Inc.
32
33 All rights reserved.
34
35 Redistribution and use in source and binary forms, with or without
36 modification, are permitted provided that the following conditions are met:
37 - Redistributions of source code must retain the above copyright
38 notice, this list of conditions and the following disclaimer.
39 - Redistributions in binary form must reproduce the above copyright
40 notice, this list of conditions and the following disclaimer in
41 the documentation and/or other materials provided with the
42 distribution.
43 - Neither the name of Analog Devices, Inc. nor the names of its
44 contributors may be used to endorse or promote products derived
45 from this software without specific prior written permission.
46 - The use of this software may or may not infringe the patent rights
47 of one or more patent holders. This license does not release you
48 from the requirement that you obtain separate licenses from these
49 patent holders to use this software.
50 - Use of the software either in source or binary form, must be run
51 on or directly connected to an Analog Devices Inc. component.
52
53 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
54 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
55 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
56 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
57 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
59 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
60 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
61 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 */
64
65 /*! @file
66 @ingroup LTC1592
67 Header File for LTC1592: 16-bit SoftSpan DAC with Programmable Output Range
68 */
69
70 #ifndef LTC1592_H
71 #define LTC1592_H
72
73 //! Headerfiles
74 #include "Linduino.h"
75 #include <stdint.h>
76
77 //! Define the SPI CS pin
78 #ifndef LTC1592_CS
79 #define LTC1592_CS QUIKEVAL_CS
80 #endif
81
82 //! @name LTC1592 Commands
83 //! @{
84 #define LTC1592_COPY_SREG_TO_BUF1 0x00
85 #define LTC1592_COPY_BUF1_TO_BUF2 0x10
86 #define LTC1592_COPY_SREG_TO_BUF1_BUF2 0x20
87 #define LTC1592_RANGE_0_TO_5V 0x80
88 #define LTC1592_RANGE_0_TO_10V 0x90
89 #define LTC1592_RANGE_PLUS_MINUS_5V 0xA0
90 #define LTC1592_RANGE_PLUS_MINUS_10V 0xB0
91 #define LTC1592_RANGE_PLUS_MINUS_2_5V 0xC0
92 #define LTC1592_RANGE_MINUS_2_5V_TO_PLUS_7_5V 0xD0
93 //! @}
94
95 //! Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data
96 //! @return void
97 void LTC1592_write(uint8_t cs, //!< Chip Select
98 uint8_t dac_command, //!< 4-bit command: c3 c2 c1 c0 X X X X
99 uint16_t data //!< 16-bit digital data input
100 );
101
102 //! Calculates the voltage from ADC output data depending on the channel configuration
103 //! @return Floating point voltage
104 float LTC1592_code_to_voltage(uint16_t data, //!< 16-bit digital data input
105 float RANGE_HIGH, //!< Maximum voltage range
106 float RANGE_LOW //!< Minimum voltage range
107 );
108
109 //! Calculates the 16 bit data code from voltage
110 //! @return 16 bit data code
111 uint16_t LTC1592_voltage_to_code(float voltage, //!< Voltage to be converted
112 float RANGE_HIGH, //!< Maximum voltage range
113 float RANGE_LOW //!< Minimum voltage range
114 );
115
116 #endif // LTC1592_H
Linduino.h
Header File for Linduino Libraries and Demo Code.
LTC1592_code_to_voltage
float LTC1592_code_to_voltage(uint16_t data, float RANGE_HIGH, float RANGE_LOW)
Calculates the voltage from ADC output data depending on the channel configuration.
Definition: LTC1592.cpp:92
data
union LT_union_int32_4bytes data
Definition: DC2094A.ino:138
LTC1592_voltage_to_code
uint16_t LTC1592_voltage_to_code(float voltage, float RANGE_HIGH, float RANGE_LOW)
Calculates the 16 bit data code from voltage.
Definition: LTC1592.cpp:100
LTC1592_write
void LTC1592_write(uint8_t cs, uint8_t dac_command, uint16_t data)
Transmits 24 bit input stream: 4-bit command + 4-bit don&#39;t-care + 16-bit data.
Definition: LTC1592.cpp:80
voltage
static float voltage
Definition: DC2289AA.ino:71