Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC6950.h
Go to the documentation of this file.
1 /*!
2  LTC6950: 1.4GHz Low Phase Noise, Low Jitter PLL with Clock Distribution
3 
4 @verbatim
5  SPI DATA FORMAT (MSB First):
6 
7  Write Sequence:
8  Byte #1 Byte #2
9  MOSI: A6 A5 A4 A3 A2 A1 A0 W D7 D6 D5 D4 D3 D2 D1 D0
10  MISO: X X X X X X X X X X X X X X X X
11 
12  Read Sequence:
13  Byte #1 Byte #2
14  MOSI: A6 A5 A4 A3 A2 A1 A0 R X X X X X X X X
15  MISO: X X X X X X X X D7 D6 D5 D4 D3 D2 D1 D0
16 
17  W : SPI Write (0)
18  R : SPI Read (1)
19  Ax : Address
20  Dx : Data Bits
21  X : Don't care
22 
23 @endverbatim
24 
25 http://www.linear.com/product/LTC6950
26 
27 http://www.linear.com/product/LTC6950#demoboards
28 
29 
30 Copyright 2018(c) Analog Devices, Inc.
31 
32 All rights reserved.
33 
34 Redistribution and use in source and binary forms, with or without
35 modification, are permitted provided that the following conditions are met:
36  - Redistributions of source code must retain the above copyright
37  notice, this list of conditions and the following disclaimer.
38  - Redistributions in binary form must reproduce the above copyright
39  notice, this list of conditions and the following disclaimer in
40  the documentation and/or other materials provided with the
41  distribution.
42  - Neither the name of Analog Devices, Inc. nor the names of its
43  contributors may be used to endorse or promote products derived
44  from this software without specific prior written permission.
45  - The use of this software may or may not infringe the patent rights
46  of one or more patent holders. This license does not release you
47  from the requirement that you obtain separate licenses from these
48  patent holders to use this software.
49  - Use of the software either in source or binary form, must be run
50  on or directly connected to an Analog Devices Inc. component.
51 
52 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
53 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
54 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
56 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
58 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63 
64 /*! @file
65  @ingroup LTC6950
66  Header for LTC6950: 1.4GHz Low Phase Noise, Low Jitter PLL with Clock Distribution
67 */
68 
69 #ifndef LTC6950_H
70 
71 #define LTC6950_H
72 
73 
74 //! Define the SPI CS pin
75 #ifndef LTC6950_CS
76 #define LTC6950_CS QUIKEVAL_CS //! SPI Chip Select Pin
77 #endif
78 
79 
80 /*! @name LTC6950 Registers Fields in Alphabetical Order */
81 #define LTC6950_CMSINV 1 //!< for spi_map array, defines location for field specific information used to create the spi map
82 #define LTC6950_CP 2 //!< for spi_map array, defines location for field specific information used to create the spi map
83 #define LTC6950_CPCHI 3 //!< for spi_map array, defines location for field specific information used to create the spi map
84 #define LTC6950_CPCLO 4 //!< for spi_map array, defines location for field specific information used to create the spi map
85 #define LTC6950_CPDN 5 //!< for spi_map array, defines location for field specific information used to create the spi map
86 #define LTC6950_CPINV 6 //!< for spi_map array, defines location for field specific information used to create the spi map
87 #define LTC6950_CPMID 7 //!< for spi_map array, defines location for field specific information used to create the spi map
88 #define LTC6950_CPRST 8 //!< for spi_map array, defines location for field specific information used to create the spi map
89 #define LTC6950_CPUP 9 //!< for spi_map array, defines location for field specific information used to create the spi map
90 #define LTC6950_CPWIDE 10 //!< for spi_map array, defines location for field specific information used to create the spi map
91 #define LTC6950_DEL0 11 //!< for spi_map array, defines location for field specific information used to create the spi map
92 #define LTC6950_DEL1 12 //!< for spi_map array, defines location for field specific information used to create the spi map
93 #define LTC6950_DEL2 13 //!< for spi_map array, defines location for field specific information used to create the spi map
94 #define LTC6950_DEL3 14 //!< for spi_map array, defines location for field specific information used to create the spi map
95 #define LTC6950_DEL4 15 //!< for spi_map array, defines location for field specific information used to create the spi map
96 #define LTC6950_FILTR 16 //!< for spi_map array, defines location for field specific information used to create the spi map
97 #define LTC6950_FILTV 17 //!< for spi_map array, defines location for field specific information used to create the spi map
98 #define LTC6950_FLDRV0 18 //!< for spi_map array, defines location for field specific information used to create the spi map
99 #define LTC6950_FLDRV1 19 //!< for spi_map array, defines location for field specific information used to create the spi map
100 #define LTC6950_FLDRV2 20 //!< for spi_map array, defines location for field specific information used to create the spi map
101 #define LTC6950_FLDRV3 21 //!< for spi_map array, defines location for field specific information used to create the spi map
102 #define LTC6950_FLDRV4 22 //!< for spi_map array, defines location for field specific information used to create the spi map
103 #define LTC6950_IBIAS0 23 //!< for spi_map array, defines location for field specific information used to create the spi map
104 #define LTC6950_IBIAS1 24 //!< for spi_map array, defines location for field specific information used to create the spi map
105 #define LTC6950_IBIAS2 25 //!< for spi_map array, defines location for field specific information used to create the spi map
106 #define LTC6950_IBIAS3 26 //!< for spi_map array, defines location for field specific information used to create the spi map
107 #define LTC6950_INV_ST1 27 //!< for spi_map array, defines location for field specific information used to create the spi map
108 #define LTC6950_INV_ST2 28 //!< for spi_map array, defines location for field specific information used to create the spi map
109 #define LTC6950_LKCT 29 //!< for spi_map array, defines location for field specific information used to create the spi map
110 #define LTC6950_LKEN 30 //!< for spi_map array, defines location for field specific information used to create the spi map
111 #define LTC6950_LKWIN 31 //!< for spi_map array, defines location for field specific information used to create the spi map
112 #define LTC6950_LOCK 32 //!< for spi_map array, defines location for field specific information used to create the spi map
113 #define LTC6950_LVCMS 33 //!< for spi_map array, defines location for field specific information used to create the spi map
114 #define LTC6950_M0 34 //!< for spi_map array, defines location for field specific information used to create the spi map
115 #define LTC6950_M1 35 //!< for spi_map array, defines location for field specific information used to create the spi map
116 #define LTC6950_M2 36 //!< for spi_map array, defines location for field specific information used to create the spi map
117 #define LTC6950_M3 37 //!< for spi_map array, defines location for field specific information used to create the spi map
118 #define LTC6950_M4 38 //!< for spi_map array, defines location for field specific information used to create the spi map
119 #define LTC6950_N 39 //!< for spi_map array, defines location for field specific information used to create the spi map
120 #define LTC6950_NO_REF 40 //!< for spi_map array, defines location for field specific information used to create the spi map
121 #define LTC6950_NO_VCO 41 //!< for spi_map array, defines location for field specific information used to create the spi map
122 #define LTC6950_PART 42 //!< for spi_map array, defines location for field specific information used to create the spi map
123 #define LTC6950_PDALL 43 //!< for spi_map array, defines location for field specific information used to create the spi map
124 #define LTC6950_PD_DIV0 44 //!< for spi_map array, defines location for field specific information used to create the spi map
125 #define LTC6950_PD_DIV1 45 //!< for spi_map array, defines location for field specific information used to create the spi map
126 #define LTC6950_PD_DIV2 46 //!< for spi_map array, defines location for field specific information used to create the spi map
127 #define LTC6950_PD_DIV3 47 //!< for spi_map array, defines location for field specific information used to create the spi map
128 #define LTC6950_PD_DIV4 48 //!< for spi_map array, defines location for field specific information used to create the spi map
129 #define LTC6950_PD_OUT0 49 //!< for spi_map array, defines location for field specific information used to create the spi map
130 #define LTC6950_PD_OUT1 50 //!< for spi_map array, defines location for field specific information used to create the spi map
131 #define LTC6950_PD_OUT2 51 //!< for spi_map array, defines location for field specific information used to create the spi map
132 #define LTC6950_PD_OUT3 52 //!< for spi_map array, defines location for field specific information used to create the spi map
133 #define LTC6950_PD_OUT4 53 //!< for spi_map array, defines location for field specific information used to create the spi map
134 #define LTC6950_PDPLL 54 //!< for spi_map array, defines location for field specific information used to create the spi map
135 #define LTC6950_PDREFAC 55 //!< for spi_map array, defines location for field specific information used to create the spi map
136 #define LTC6950_PDVCOAC 56 //!< for spi_map array, defines location for field specific information used to create the spi map
137 #define LTC6950_R 57 //!< for spi_map array, defines location for field specific information used to create the spi map
138 #define LTC6950_RDIVOUT 58 //!< for spi_map array, defines location for field specific information used to create the spi map
139 #define LTC6950_RES6950 59 //!< for spi_map array, defines location for field specific information used to create the spi map
140 #define LTC6950_RESET_R 60 //!< for spi_map array, defines location for field specific information used to create the spi map
141 #define LTC6950_RESET_N 61 //!< for spi_map array, defines location for field specific information used to create the spi map
142 #define LTC6950_REV 62 //!< for spi_map array, defines location for field specific information used to create the spi map
143 #define LTC6950_SM1 63 //!< for spi_map array, defines location for field specific information used to create the spi map
144 #define LTC6950_SM2 64 //!< for spi_map array, defines location for field specific information used to create the spi map
145 #define LTC6950_SYNCMD 65 //!< for spi_map array, defines location for field specific information used to create the spi map
146 #define LTC6950_SYNC_EN0 66 //!< for spi_map array, defines location for field specific information used to create the spi map
147 #define LTC6950_SYNC_EN1 67 //!< for spi_map array, defines location for field specific information used to create the spi map
148 #define LTC6950_SYNC_EN2 68 //!< for spi_map array, defines location for field specific information used to create the spi map
149 #define LTC6950_SYNC_EN3 69 //!< for spi_map array, defines location for field specific information used to create the spi map
150 #define LTC6950_SYNC_EN4 70 //!< for spi_map array, defines location for field specific information used to create the spi map
151 #define LTC6950_THI 71 //!< for spi_map array, defines location for field specific information used to create the spi map
152 #define LTC6950_TLO 72 //!< for spi_map array, defines location for field specific information used to create the spi map
153 #define LTC6950_UNLOCK 73 //!< for spi_map array, defines location for field specific information used to create the spi map
154 
155 
156 #define LTC6950_NUM_REGADDR 23 //!< Defines number of LTC6950 SPI registers, used in spi_map array
157 #define LTC6950_NUM_REGFIELD 73 //!< Defines number of LTC6950 SPI fields, used in spi_map array
158 
159 #define ADDRx 0 //!< used for 2nd dim of 2d spi_map array
160 #define DxMSB 1 //!< used for 2nd dim of 2d spi_map array
161 #define NUMBITS 2 //!< used for 2nd dim of 2d spi_map array
162 #define R_ONLY 3 //!< used for 2nd dim of 2d spi_map array
163 
164 #define OneMHz 1000000L //!< 1MHz in long format, used in 64 bit math
165 
166 #define LTC6950_MINFREQ 0 //!< LTC6950 lower freq limit
167 #define LTC6950_MAXFREQ 1400 //!< LTC6950 upper freq limit
168 
169 #define LTC6950_MIN_REF_FREQ 2 //!< LTC6950 lower reference frequency limit
170 #define LTC6950_MAX_REF_FREQ 250 //!< LTC6950 upper reference frequency limit
171 
172 //! @} */
173 
174 /* ------------------------------------------------------------------------- */
175 //! LTC6950 Read Single Address
176 //! reads 8 bit Data field to LTC6950.
177 //! has to shift data by one bit to account for RW bit
178 //! @return data that was read from address
179 uint8_t LTC6950_read(uint8_t cs, //!< Chip Select Pin
180  int8_t address //!< Register address for the LTC6950.
181  );
182 
183 
184 /* ------------------------------------------------------------------------- */
185 //! LTC6950 Read Single Field
186 //! For SPI FIELDS located in 1 or multiple address location
187 //! reads specific address locations
188 //! identifies and returns specific field in question
189 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
190 //! @return data that was read from field
191 long LTC6950_read_field(uint8_t cs, //!< Chip Select Pin
192  uint8_t address, //!< Register address for the LTC6950.
193  uint8_t MSB_loc, //!< MSB bit location of field
194  uint8_t numbits //!< length of field (i.e. number of bits in field)
195  );
196 
197 
198 /* ------------------------------------------------------------------------- */
199 //! Gets the LTC6950 SPI field value
200 //! calls function LTC6950_read_field, which
201 //! reads specific address locations
202 //! identifies and returns specific field in question
203 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
204 //! @return data that was read from field
205 long get_LTC6950_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
206  uint8_t f //!< SPI field number
207  );
208 
209 
210 /* ------------------------------------------------------------------------- */
211 //! LTC6950 Write Single Address
212 //! writes 8 bit Data field to LTC6950.
213 //! has to shift data by one bit to account for RW bit
214 //! @return void
215 void LTC6950_write(uint8_t cs, //!< Chip Select Pin
216  uint8_t address, //!< Register address for the LTC6950.
217  uint8_t Data //!< 8-bit data to be written to register
218  );
219 
220 
221 /* ------------------------------------------------------------------------- */
222 //! LTC6950 Write Single Field
223 //! For SPI FIELDS in 1 or multiple address locations
224 //! reads specific address/field location then writes to specific field
225 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
226 //! @return void
227 uint8_t LTC6950_write_field(uint8_t cs, //!< Chip Select Pin
228  long field_data, //!< Value field value to be set to
229  uint8_t address, //!< Register address for the LTC6950.
230  uint8_t MSB_loc, //!< MSB bit location of field
231  uint8_t numbits //!< length of field (i.e. number of bits in field)
232  );
233 
234 
235 /* ------------------------------------------------------------------------- */
236 //! Sets the LTC6950 SPI field value
237 //! calls function LTC6950_read_field, which
238 //! reads specific address/field location then writes to specific field
239 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
240 //! @return void
241 void set_LTC6950_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
242  uint8_t f, //!< SPI field number
243  long field_data //!< Value field value to be set to
244  );
245 
246 
247 /* ------------------------------------------------------------------------- */
248 //! Writes values to ALL LTC6950 RW addresses
249 //! @return void
250 void set_LTC6950_ALLREGS(uint8_t cs, //!< Chip Select Pin
251  uint8_t reg01, //!< LTC6950 register 1
252  uint8_t reg02, //!< LTC6950 register 2
253  uint8_t reg03, //!< LTC6950 register 3
254  uint8_t reg04, //!< LTC6950 register 4
255  uint8_t reg05, //!< LTC6950 register 5
256  uint8_t reg06, //!< LTC6950 register 6
257  uint8_t reg07, //!< LTC6950 register 7
258  uint8_t reg08, //!< LTC6950 register 8
259  uint8_t reg09, //!< LTC6950 register 9
260  uint8_t reg0A, //!< LTC6950 register 10
261  uint8_t reg0B, //!< LTC6950 register 11
262  uint8_t reg0C, //!< LTC6950 register 12
263  uint8_t reg0D, //!< LTC6950 register 13
264  uint8_t reg0E, //!< LTC6950 register 14
265  uint8_t reg0F, //!< LTC6950 register 15
266  uint8_t reg10, //!< LTC6950 register 16
267  uint8_t reg11, //!< LTC6950 register 17
268  uint8_t reg12, //!< LTC6950 register 18
269  uint8_t reg13, //!< LTC6950 register 19
270  uint8_t reg14, //!< LTC6950 register 20
271  uint8_t reg15 //!< LTC6950 register 21
272  );
273 
274 /* ------------------------------------------------------------------------- */
275 //! Initializes the SPI MAP arrays
276 //! The values set in initialization are used for all the LTC6950 SPI/WRITE and
277 //! read functions (set_LTC6950_SPI_FIELD, get_LTC6950_SPI_FIELD,
278 //! LTC6950_read, LTC6950_write, etc, etc)
279 //! @return void
280 void LTC6950_init();
281 
282 
283 /* ------------------------------------------------------------------------- */
284 //! returns # of addresses in parts register map (array size)
285 //! @return # of addresses in parts register map
286 uint8_t get_LTC6950_REGSIZE();
287 
288 
289 /* ------------------------------------------------------------------------- */
290 //! returns the number of bits for a given field name in the SPI map
291 //! @return the number of bits for a given field name in the SPI map
292 uint8_t get_LTC6950_SPI_FIELD_NUMBITS(uint8_t f //!< SPI field number
293  );
294 
295 
296 /* ------------------------------------------------------------------------- */
297 //! returns if the given field name is (0)read/write or (1)read_only field
298 //! @return if the given field is a (0)read/write or (1)read_only field
299 uint8_t get_LTC6950_SPI_FIELD_RW(uint8_t f //!< SPI field number
300  ) ;
301 
302 
303 /* ------------------------------------------------------------------------- */
304 //! calculates the output divider setting based on the frf and on board
305 //! VCO frequencies of LTC6950
306 //! @return odiv = 1-6 divider setting for valid frequency, or 999 for invalid odiv
307 unsigned long LTC6950_calc_odiv(unsigned long frf[2] //!< output frequency
308  );
309 
310 /* ------------------------------------------------------------------------- */
311 //! FUNCTION: LTC6950_set_frf
312 //! Calculates the integer (N) and output divider (OD) SPI values
313 //! using self created 64bit math functions. For Out0 only. Use menu 3 to set dividers to
314 //! achieve desired frequencies on other outputs.
315 //!
316 //! Datasheet equations
317 //! - fvco = fpfd*(N + F)
318 //! - frf = fvco/O
319 //! - fpfd = fref/R
320 //!
321 //! can be modified to the following equations
322 //! - N = (int) (fvco/fpfd) = (int) frf*O*R/fref
323 //!
324 //! where
325 //! - N = ndiv, O= M0div in the code below
326 //!
327 //! Linduino One (Arduino Uno) is limited to 32 bit floats/double/long.
328 //! 32 bit math functions will create rounding errors with the above equations,
329 //! tha can result in frequency errors.
330 //! Therefore, the following code uses self created 64bit functions for 64bit integer math.
331 //!
332 //! - frf (33 bits) LTC6950 max frf/fvco = 1.4GHZ, which is 23 bit number (2^31 = 2.147G)
333 //! - fref (23 bits) LTC6950 min fref = 2MHz, which is a 20 bit number (2^20 = 1.05M)
334 //! - O (6 bits)
335 //! - R (10 bits)
336 //!
337 //! step 1: create 64 bit frf and fref numbers
338 //!
339 //! step 2: calculate O (output divider)
340 //!
341 //! step 3: get current R-divider setting
342 //!
343 //! step 4: calculate frf*O*R
344 //! - max bit count/resolution: 31b+6b+10b= 47b
345 //!
346 //! step 5: calculate N(11b), using value from step 1
347 //! - N = (int) frf*O*R/fref
348 //! - max bit count/resolution: 47b-20b = 27b
349 //!
350 //! step 6: find N for closest frequency - accounts for rounding with integer math
351 //! - 64b-47b=17b (using 16b instead of 17b)
352 //!
353 //! @return void
354 void LTC6950_set_frf();
355 
356 
357 /* ------------------------------------------------------------------------- */
358 //! sets globals LTC6950_Fref_MHz and LTC6950_Fref_Hz
359 //! @return void
360 void set_LTC6950_global_fref(unsigned long fref_MHz, unsigned long fref_Hz);
361 
362 
363 /* ------------------------------------------------------------------------- */
364 //! sets globals LTC6950_Frf_MHz and LTC6950_Frf_Hz
365 //! @return void
366 void set_LTC6950_global_frf(unsigned long frf_MHz, unsigned long frf_Hz);
367 
368 /* ------------------------------------------------------------------------- */
369 //! sets globals LTC6950_VCO_Max_Freq_MHz, LTC6950_VCO_Max_Freq_Hz, LTC6950_VCO_Min_Freq_MHz and LTC6950_VCO_Min_Freq_Hz
370 //! @return void
371 void set_LTC6950_global_vcolim(unsigned long fvco_max_MHz, unsigned long fvco_max_Hz, unsigned long fvco_min_MHz, unsigned long fvco_min_Hz);
372 
373 
374 /* ------------------------------------------------------------------------- */
375 //! returns global LTC6950_Fref_MHz
376 //! @return LTC6950_Fref_MHz
377 unsigned long get_LTC6950_global_fref_MHz();
378 
379 
380 /* ------------------------------------------------------------------------- */
381 //! returns global LTC6950_Fref_Hz
382 //! @return LTC6950_Fref_Hz
383 unsigned long get_LTC6950_global_fref_Hz();
384 
385 
386 /* ------------------------------------------------------------------------- */
387 //! returns global LTC6950_Frf_MHz
388 //! @return LTC6950_Frf_MHz
389 unsigned long get_LTC6950_global_frf_MHz();
390 
391 
392 /* ------------------------------------------------------------------------- */
393 //! returns global LTC6950_Frf_Hz
394 //! @return LTC6950_Frf_Hz
395 unsigned long get_LTC6950_global_frf_Hz();
396 
397 
398 /* ------------------------------------------------------------------------- */
399 //! returns global LTC6950_VCO_Max_Freq_MHz
400 //! @return LTC6950_VCO_Max_Freq_MHz
401 unsigned long get_LTC6950_global_VCO_MAX_MHz();
402 
403 
404 /* ------------------------------------------------------------------------- */
405 //! returns global LTC6950_VCO_Min_Freq_MHz
406 //! @return LTC6950_VCO_Min_Freq_MHz
407 unsigned long get_LTC6950_global_VCO_MIN_MHz();
408 
409 
410 /* ------------------------------------------------------------------------- */
411 //! returns global LTC6950_VCO_Max_Freq_Hz
412 //! @return LTC6950_VCO_Max_Freq_Hz
413 unsigned long get_LTC6950_global_VCO_MAX_Hz();
414 
415 
416 /* ------------------------------------------------------------------------- */
417 //! returns global LTC6950_VCO_Min_Freq_Hz
418 //! @return LTC6950_VCO_Min_Freq_Hz
419 unsigned long get_LTC6950_global_VCO_MIN_Hz();
420 
421 
422 /* ------------------------------------------------------------------------- */
423 //! create a 64 bit Hz number from
424 //! 32 bit xxxx MHz number and 32 bit yyy yyy Hz number.
425 //! A) if an < 2^32 bits:
426 //! - an(upper 32b) = 0;
427 //! - an(lower 32b) = MHzPart(32b)*1MHz + HzPart (32b)
428 //!
429 //! B) if an > 2^32 bits (4,294,967,296):
430 //! - an(upper 32b) = 1
431 //! - an(lower 32b) = ((MHzPart-4294)*1MHz+HzPart)-967296
432 //! @return void
433 void HZto64(unsigned long an[], //!< 64 bit number, 1x2 32 bit array
434  unsigned long MHzPart, //!< integer in MHZ
435  unsigned long HzPart //!< integer in Hz
436  );
437 
438 
439 /* ------------------------------------------------------------------------- */
440 //! Creates a equivalent 64 bit number from 2 32 bit numbers
441 //! - an[0]=bigPart upper 32 bits
442 //! - an[1]=littlePart lower 32 bits
443 //! @return void
444 void init64(unsigned long an[], //!< 64 bit number, 1x2 32 bit array
445  unsigned long bigPart, //!< upper 32 bits
446  unsigned long littlePart //!< lower 32 bits
447  );
448 
449 /* ------------------------------------------------------------------------- */
450 //! Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
451 //! @return void
452 void shl64(unsigned long an[] //!< an[] = an[]<<1
453  );
454 
455 /* ------------------------------------------------------------------------- */
456 //! Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum)
457 //! @return void
458 void shl64by(unsigned long an[], //!< an[] = an[]<<shiftnum
459  uint8_t shiftnum //!< number of bits to shift left
460  );
461 
462 /* ------------------------------------------------------------------------- */
463 //! Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
464 //! @return void
465 void shr64(unsigned long an[] //!< an[] = an[]>>shiftnum
466  );
467 
468 /* ------------------------------------------------------------------------- */
469 //! Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
470 //! @return void
471 void shr64by(unsigned long an[], //!< an[] = an[]>>shiftnum
472  uint8_t shiftnum //!< number of bits to shift right
473  );
474 
475 /* ------------------------------------------------------------------------- */
476 //! 64 bit Add ann to an (an[] = an[] + ann[])
477 //! @return void
478 void add64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
479  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
480  );
481 
482 /* ------------------------------------------------------------------------- */
483 //! 64 bit Subtract ann from an (an[] = an[] - ann[])
484 //! @return void
485 void sub64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
486  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
487  );
488 
489 /* ------------------------------------------------------------------------- */
490 //! 64 bit, if an == ann, then true
491 //! @return true, if an==ann; false, if an<>ann
492 boolean eq64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
493  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
494  );
495 
496 /* ------------------------------------------------------------------------- */
497 //! 64 bit, if an < ann, then true
498 //! @return true, if an<ann; false, if an=>ann
499 boolean lt64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
500  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
501  );
502 
503 /* ------------------------------------------------------------------------- */
504 //! 64 bit Divide, num=num/div
505 //! @return void
506 void div64(unsigned long num[], //!< numerator: 64 bit number, in 1x2 32bit array
507  unsigned long den[] //!< denominator: 64 bit number, in 1x2 32bit array
508  );
509 
510 
511 /* ------------------------------------------------------------------------- */
512 //! 64 bit multiply, an=an*ann
513 //! @return void
514 void mul64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
515  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
516  );
517 
518 /* ------------------------------------------------------------------------- */
519 //! Prints HEX representation of 64 bit an
520 //! @return void
521 void prt(unsigned long an[] //!< 64 bit number, in 1x2 32bit array
522  );
523 
524 #endif // LTC6950_H
void div64(unsigned long num[], unsigned long den[])
64 bit Divide, num=num/div
Definition: LTC6945.cpp:859
void add64(unsigned long an[], unsigned long ann[])
64 bit Add ann to an (an[] = an[] + ann[])
Definition: LTC6945.cpp:810
uint8_t get_LTC6950_REGSIZE()
returns # of addresses in parts register map (array size)
Definition: LTC6950.cpp:239
void sub64(unsigned long an[], unsigned long ann[])
64 bit Subtract ann from an (an[] = an[] - ann[])
Definition: LTC6945.cpp:823
unsigned long get_LTC6950_global_fref_MHz()
returns global LTC6950_Fref_MHz
Definition: LTC6950.cpp:641
unsigned long get_LTC6950_global_frf_Hz()
returns global LTC6950_Frf_Hz
Definition: LTC6950.cpp:656
void LTC6950_set_frf()
FUNCTION: LTC6950_set_frf Calculates the integer (N) and output divider (OD) SPI values using self cr...
Definition: LTC6950.cpp:766
long LTC6950_read_field(uint8_t cs, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6950 Read Single Field For SPI FIELDS located in 1 or multiple address location reads specific add...
Definition: LTC6950.cpp:125
void mul64(unsigned long an[], unsigned long ann[])
64 bit multiply, an=an*ann
Definition: LTC6945.cpp:906
void HZto64(unsigned long an[], unsigned long MHzPart, unsigned long HzPart)
create a 64 bit Hz number from 32 bit xxxx MHz number and 32 bit yyy yyy Hz number.
Definition: LTC6945.cpp:729
void init64(unsigned long an[], unsigned long bigPart, unsigned long littlePart)
Creates a equivalent 64 bit number from 2 32 bit numbers.
Definition: LTC6945.cpp:712
void set_LTC6950_global_fref(unsigned long fref_MHz, unsigned long fref_Hz)
sets globals LTC6950_Fref_MHz and LTC6950_Fref_Hz
Definition: LTC6950.cpp:619
unsigned long get_LTC6950_global_frf_MHz()
returns global LTC6950_Frf_MHz
Definition: LTC6950.cpp:651
static uint8_t address
Definition: DC2091A.ino:83
unsigned long get_LTC6950_global_VCO_MAX_MHz()
returns global LTC6950_VCO_Max_Freq_MHz
Definition: LTC6950.cpp:661
void set_LTC6950_global_frf(unsigned long frf_MHz, unsigned long frf_Hz)
sets globals LTC6950_Frf_MHz and LTC6950_Frf_Hz
Definition: LTC6950.cpp:625
uint8_t get_LTC6950_SPI_FIELD_RW(uint8_t f)
returns if the given field name is (0)read/write or (1)read_only field
Definition: LTC6950.cpp:259
unsigned long get_LTC6950_global_VCO_MIN_MHz()
returns global LTC6950_VCO_Min_Freq_MHz
Definition: LTC6950.cpp:666
void set_LTC6950_global_vcolim(unsigned long fvco_max_MHz, unsigned long fvco_max_Hz, unsigned long fvco_min_MHz, unsigned long fvco_min_Hz)
sets globals LTC6950_VCO_Max_Freq_MHz, LTC6950_VCO_Max_Freq_Hz, LTC6950_VCO_Min_Freq_MHz and LTC6950_...
Definition: LTC6950.cpp:631
unsigned long get_LTC6950_global_fref_Hz()
returns global LTC6950_Fref_Hz
Definition: LTC6950.cpp:646
void shr64by(unsigned long an[], uint8_t shiftnum)
Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
Definition: LTC6945.cpp:792
uint8_t LTC6950_write_field(uint8_t cs, long field_data, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6950 Write Single Field For SPI FIELDS in 1 or multiple address locations reads specific address/f...
Definition: LTC6950.cpp:188
long get_LTC6950_SPI_FIELD(uint8_t cs, uint8_t f)
Gets the LTC6950 SPI field value calls function LTC6950_read_field, which reads specific address loca...
Definition: LTC6950.cpp:161
unsigned long get_LTC6950_global_VCO_MIN_Hz()
returns global LTC6950_VCO_Min_Freq_Hz
Definition: LTC6950.cpp:676
uint8_t LTC6950_read(uint8_t cs, int8_t address)
LTC6950 Read Single Address reads 8 bit Data field to LTC6950.
Definition: LTC6950.cpp:105
boolean lt64(unsigned long an[], unsigned long ann[])
64 bit, if an < ann, then true
Definition: LTC6945.cpp:848
unsigned long LTC6950_calc_odiv(unsigned long frf[2])
calculates the output divider setting based on the frf and on board VCO frequencies of LTC6950 ...
Definition: LTC6950.cpp:687
uint8_t get_LTC6950_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
Definition: LTC6950.cpp:249
void shl64by(unsigned long an[], uint8_t shiftnum)
Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum)
Definition: LTC6945.cpp:774
boolean eq64(unsigned long an[], unsigned long ann[])
64 bit, if an == ann, then true
Definition: LTC6945.cpp:838
void LTC6950_init()
Initializes the SPI MAP arrays The values set in initialization are used for all the LTC6950 SPI/WRIT...
Definition: LTC6950.cpp:319
void shl64(unsigned long an[])
Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
Definition: LTC6945.cpp:748
unsigned long get_LTC6950_global_VCO_MAX_Hz()
returns global LTC6950_VCO_Max_Freq_Hz
Definition: LTC6950.cpp:671
void set_LTC6950_ALLREGS(uint8_t cs, uint8_t reg01, uint8_t reg02, uint8_t reg03, uint8_t reg04, uint8_t reg05, uint8_t reg06, uint8_t reg07, uint8_t reg08, uint8_t reg09, uint8_t reg0A, uint8_t reg0B, uint8_t reg0C, uint8_t reg0D, uint8_t reg0E, uint8_t reg0F, uint8_t reg10, uint8_t reg11, uint8_t reg12, uint8_t reg13, uint8_t reg14, uint8_t reg15)
Writes values to ALL LTC6950 RW addresses.
Definition: LTC6950.cpp:282
void LTC6950_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6950 Write Single Address writes 8 bit Data field to LTC6950.
Definition: LTC6950.cpp:172
void prt(unsigned long an[])
Prints HEX representation of 64 bit an.
Definition: LTC6945.cpp:698
void set_LTC6950_SPI_FIELD(uint8_t cs, uint8_t f, long field_data)
Sets the LTC6950 SPI field value calls function LTC6950_read_field, which reads specific address/fiel...
Definition: LTC6950.cpp:272
void shr64(unsigned long an[])
Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
Definition: LTC6945.cpp:761