Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC6903.h
Go to the documentation of this file.
1 /*!
2 LTC6903: 1kHz to 68MHz Serial Port Programmable Oscillator
3 
4 @verbatim
5 
6 The LTC6903/LTC6904 are low power self contained digital
7 frequency sources providing a precision frequency from
8 1kHz to 68MHz, set through a serial port. The LTC6903/
9 LTC6904 require no external components other than a
10 power supply bypass capacitor, and they operate over a
11 single wide supply range of 2.7V to 5.5V.
12 
13 @endverbatim
14 
15 http://www.linear.com/product/LTC6903
16 
17 http://www.linear.com/product/LTC6903#demoboards
18 
19 
20 Copyright 2018(c) Analog Devices, Inc.
21 
22 All rights reserved.
23 
24 Redistribution and use in source and binary forms, with or without
25 modification, are permitted provided that the following conditions are met:
26  - Redistributions of source code must retain the above copyright
27  notice, this list of conditions and the following disclaimer.
28  - Redistributions in binary form must reproduce the above copyright
29  notice, this list of conditions and the following disclaimer in
30  the documentation and/or other materials provided with the
31  distribution.
32  - Neither the name of Analog Devices, Inc. nor the names of its
33  contributors may be used to endorse or promote products derived
34  from this software without specific prior written permission.
35  - The use of this software may or may not infringe the patent rights
36  of one or more patent holders. This license does not release you
37  from the requirement that you obtain separate licenses from these
38  patent holders to use this software.
39  - Use of the software either in source or binary form, must be run
40  on or directly connected to an Analog Devices Inc. component.
41 
42 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
43 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
44 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
45 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
46 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
48 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
51 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */
53 
54 /*! @file
55  @ingroup LTC6903
56  Library Header File for LTC6903: 1kHz to 68MHz Serial Port Programmable Oscillator
57 */
58 
59 #ifndef LTC6903_H
60 #define LTC6903_H
61 
62 #include <SPI.h>
63 
64 //! Define the SPI CS pin
65 #ifndef LTC6903_CS
66 #define LTC6903_CS QUIKEVAL_CS
67 #endif
68 
69 /*!
70 @{
71 | OCT Options | f>= (MHz) | f< (MHz) |
72 | :----------- | :--------: | :-------: |
73 | LTC6903_OCT_15 | 34.05 | 68.03 |
74 | LTC6903_OCT_14 | 17.02 | 34.01 |
75 | LTC6903_OCT_13 | 8.5111 | 17.01 |
76 | LTC6903_OCT_12 | 4.256 | 8.503 |
77 | LTC6903_OCT_11 | 2.128 | 4.252 |
78 | LTC6903_OCT_10 | 1.064 | 2.126 |
79 | LTC6903_OCT_9 | 0.532 | 1.063 |
80 | LTC6903_OCT_8 | 0.266 | 0.5314 |
81 | LTC6903_OCT_7 | 0.133 | 0.2657 |
82 | LTC6903_OCT_6 | 0.0665 | 0.1329 |
83 | LTC6903_OCT_5 | 0.03325 | 0.06643 |
84 | LTC6903_OCT_4 | 0.01662 | 0.03322 |
85 | LTC6903_OCT_3 | 0.008312 | 0.01661 |
86 | LTC6903_OCT_2 | 0.004156 | 0.008304 |
87 | LTC6903_OCT_1 | 0.002078 | 0.004152 |
88 | LTC6903_OCT_0 | 0.001039 | 0.002076 |
89 */
90 // OCT Options
91 // f>= (MHz) | f< (MHz)
92 #define LTC6903_OCT_15 0x0F // 34.05 | 68.03
93 #define LTC6903_OCT_14 0x0E // 17.02 | 34.01
94 #define LTC6903_OCT_13 0x0D // 8.5111 | 17.01
95 #define LTC6903_OCT_12 0x0C // 4.256 | 8.503
96 #define LTC6903_OCT_11 0x0B // 2.128 | 4.252
97 #define LTC6903_OCT_10 0x0A // 1.064 | 2.126
98 #define LTC6903_OCT_9 0x09 // 0.532 | 1.063
99 #define LTC6903_OCT_8 0x08 // 0.266 | 0.5314
100 #define LTC6903_OCT_7 0x07 // 0.133 | 0.2657
101 #define LTC6903_OCT_6 0x06 // 0.0665 | 0.1329
102 #define LTC6903_OCT_5 0x05 // 0.03325 | 0.06643
103 #define LTC6903_OCT_4 0x04 // 0.01662 | 0.03322
104 #define LTC6903_OCT_3 0x03 // 0.008312 | 0.01661
105 #define LTC6903_OCT_2 0x02 // 0.004156 | 0.008304
106 #define LTC6903_OCT_1 0x01 // 0.002078 | 0.004152
107 #define LTC6903_OCT_0 0x00 // 0.001039 | 0.002076
108 //! @}
109 
110 // Output Configuration
111 #define LTC6903_CLK_ON_CLK_INV_ON 0x00 //!< Clock on, inverted clock on
112 #define LTC6903_CLK_OFF_CLK_INV_ON 0x01 //!< Clock off, inverted clock on
113 #define LTC6903_CLK_ON_CLK_INV_OFF 0x02 //!< Clock on, inverted clock off
114 #define LTC6903_POWER_DOWN 0x03 //!< Powers down clocks
115 
116 //! Writes 2 bytes
117 //! @return 1 if successful, 0 if failure
118 void LTC6903_write(uint8_t cs, //!< Chip Select Pin
119  uint16_t code //!< Code to be written
120  );
121 
122 //! Calculates the code necessary to create the clock frequency
123 //! @return the code for the LTC6903
124 uint16_t LTC6903_frequency_to_code(float frequency, //!< Clock frequency in MHz
125  uint8_t clk //!< Output configuration
126  );
127 
128 #endif
129 
void LTC6903_write(uint8_t cs, uint16_t code)
Writes 2 bytes.
Definition: LTC6903.cpp:73
uint16_t LTC6903_frequency_to_code(float frequency, uint8_t clk)
Calculates the code necessary to create the clock frequency.
Definition: LTC6903.cpp:81