Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC6947.h
Go to the documentation of this file.
1 /*!
2  LTC6947: Ultralow Noise and Spurious 0.35GHz to 6GHz FracN Synthesizer
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/LTC6947
26 
27 http://www.linear.com/product/LTC6947#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 LTC6947
66  Header for LTC6947: Ultralow Noise and Spurious 0.35GHz to 6.39GHz FracN Synthesizer
67 */
68 
69 #ifndef LTC6947_H
70 
71 #define LTC6947_H
72 
73 
74 //! Define the SPI CS pin
75 #ifndef LTC6947_CS
76 #define LTC6947_CS QUIKEVAL_CS //! SPI Chip Select Pin
77 #endif
78 
79 
80 /*! @name LTC6947 Registers Fields in Alphabetical Order */
81 #define LTC6947_AUTORST 1 //!< for spi_map array, defines location for field specific information used to create the spi map
82 #define LTC6947_BST 2 //!< for spi_map array, defines location for field specific information used to create the spi map
83 #define LTC6947_CP 3 //!< for spi_map array, defines location for field specific information used to create the spi map
84 #define LTC6947_CPCHI 4 //!< for spi_map array, defines location for field specific information used to create the spi map
85 #define LTC6947_CPCLO 5 //!< for spi_map array, defines location for field specific information used to create the spi map
86 #define LTC6947_CPDN 6 //!< for spi_map array, defines location for field specific information used to create the spi map
87 #define LTC6947_CPINV 7 //!< for spi_map array, defines location for field specific information used to create the spi map
88 #define LTC6947_CPLE 8 //!< for spi_map array, defines location for field specific information used to create the spi map
89 #define LTC6947_CPMID 9 //!< for spi_map array, defines location for field specific information used to create the spi map
90 #define LTC6947_CPRST 10 //!< for spi_map array, defines location for field specific information used to create the spi map
91 #define LTC6947_CPUP 11 //!< for spi_map array, defines location for field specific information used to create the spi map
92 #define LTC6947_CPWIDE 12 //!< for spi_map array, defines location for field specific information used to create the spi map
93 #define LTC6947_DITHEN 13 //!< for spi_map array, defines location for field specific information used to create the spi map
94 #define LTC6947_FILT 14 //!< for spi_map array, defines location for field specific information used to create the spi map
95 #define LTC6947_INTN 15 //!< for spi_map array, defines location for field specific information used to create the spi map
96 #define LTC6947_LDOEN 16 //!< for spi_map array, defines location for field specific information used to create the spi map
97 #define LTC6947_LDOV 17 //!< for spi_map array, defines location for field specific information used to create the spi map
98 #define LTC6947_LKCT 18 //!< for spi_map array, defines location for field specific information used to create the spi map
99 #define LTC6947_LKWIN 19 //!< for spi_map array, defines location for field specific information used to create the spi map
100 #define LTC6947_LOCK 20 //!< for spi_map array, defines location for field specific information used to create the spi map
101 #define LTC6947_ND 21 //!< for spi_map array, defines location for field specific information used to create the spi map
102 #define LTC6947_NUM 22 //!< for spi_map array, defines location for field specific information used to create the spi map
103 #define LTC6947_OD 23 //!< for spi_map array, defines location for field specific information used to create the spi map
104 #define LTC6947_OMUTE 24 //!< for spi_map array, defines location for field specific information used to create the spi map
105 #define LTC6947_PART 25 //!< for spi_map array, defines location for field specific information used to create the spi map
106 #define LTC6947_PDALL 26 //!< for spi_map array, defines location for field specific information used to create the spi map
107 #define LTC6947_PDFN 27 //!< for spi_map array, defines location for field specific information used to create the spi map
108 #define LTC6947_PDOUT 28 //!< for spi_map array, defines location for field specific information used to create the spi map
109 #define LTC6947_PDPLL 29 //!< for spi_map array, defines location for field specific information used to create the spi map
110 #define LTC6947_POR 30 //!< for spi_map array, defines location for field specific information used to create the spi map
111 #define LTC6947_RD 31 //!< for spi_map array, defines location for field specific information used to create the spi map
112 #define LTC6947_REV 32 //!< for spi_map array, defines location for field specific information used to create the spi map
113 #define LTC6947_RFO 33 //!< for spi_map array, defines location for field specific information used to create the spi map
114 #define LTC6947_RSTFN 34 //!< for spi_map array, defines location for field specific information used to create the spi map
115 #define LTC6947_SEED 35 //!< for spi_map array, defines location for field specific information used to create the spi map
116 #define LTC6947_THI 36 //!< for spi_map array, defines location for field specific information used to create the spi map
117 #define LTC6947_TLO 37 //!< for spi_map array, defines location for field specific information used to create the spi map
118 #define LTC6947_UNLOK 38 //!< for spi_map array, defines location for field specific information used to create the spi map
119 #define LTC6947_x 39 //!< for spi_map array, defines location for field specific information used to create the spi map
120 
121 
122 #define LTC6947_NUM_REGADDR 15 //!< Defines number of LTC6947 SPI registers, used in spi_map array
123 #define LTC6947_NUM_REGFIELD 39 //!< Defines number of LTC6947 SPI fields, used in spi_map array
124 
125 #define ADDRx 0 //!< used for 2nd dim of 2d spi_map array
126 #define DxMSB 1 //!< used for 2nd dim of 2d spi_map array
127 #define NUMBITS 2 //!< used for 2nd dim of 2d spi_map array
128 #define R_ONLY 3 //!< used for 2nd dim of 2d spi_map array
129 
130 #define OneMHz 1000000L //!< 1MHz in long format, used in 64 bit math
131 
132 #define LTC6947_MINFREQ 350 //!< LTC6947 lower freq limit
133 #define LTC6947_MAXFREQ 6000 //!< LTC6947 upper freq limit
134 
135 #define LTC6947_MIN_REF_FREQ 10 //!< LTC6947 lower reference frequency limit
136 #define LTC6947_MAX_REF_FREQ 425 //!< LTC6947 upper reference frequency limit
137 
138 //! @} */
139 
140 /* ------------------------------------------------------------------------- */
141 //! LTC6947 Read Single Address
142 //! reads 8 bit Data field to LTC6947.
143 //! has to shift data by one bit to account for RW bit
144 //! @return data that was read from address
145 uint8_t LTC6947_read(uint8_t cs, //!< Chip Select Pin
146  int8_t address //!< Register address for the LTC6947.
147  );
148 
149 
150 /* ------------------------------------------------------------------------- */
151 //! LTC6947 Read Single Field
152 //! For SPI FIELDS located in 1 or multiple address location
153 //! reads specific address locations
154 //! identifies and returns specific field in question
155 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
156 //! @return data that was read from field
157 long LTC6947_read_field(uint8_t cs, //!< Chip Select Pin
158  uint8_t address, //!< Register address for the LTC6947.
159  uint8_t MSB_loc, //!< MSB bit location of field
160  uint8_t numbits //!< length of field (i.e. number of bits in field)
161  );
162 
163 
164 /* ------------------------------------------------------------------------- */
165 //! Gets the LTC6947 SPI field value
166 //! calls function LTC6947_read_field, which
167 //! reads specific address locations
168 //! identifies and returns specific field in question
169 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
170 //! @return data that was read from field
171 long get_LTC6947_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
172  uint8_t f //!< SPI field number
173  );
174 
175 
176 /* ------------------------------------------------------------------------- */
177 //! LTC6947 Write Single Address
178 //! writes 8 bit Data field to LTC6947.
179 //! has to shift data by one bit to account for RW bit
180 //! @return void
181 void LTC6947_write(uint8_t cs, //!< Chip Select Pin
182  uint8_t address, //!< Register address for the LTC6947.
183  uint8_t Data //!< 8-bit data to be written to register
184  );
185 
186 
187 /* ------------------------------------------------------------------------- */
188 //! LTC6947 Write Single Field
189 //! For SPI FIELDS in 1 or multiple address locations
190 //! reads specific address/field location then writes to specific field
191 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
192 //! @return void
193 uint8_t LTC6947_write_field(uint8_t cs, //!< Chip Select Pin
194  long field_data, //!< Value field value to be set to
195  uint8_t address, //!< Register address for the LTC6947.
196  uint8_t MSB_loc, //!< MSB bit location of field
197  uint8_t numbits //!< length of field (i.e. number of bits in field)
198  );
199 
200 
201 /* ------------------------------------------------------------------------- */
202 //! Sets the LTC6947 SPI field value
203 //! calls function LTC6947_read_field, which
204 //! reads specific address/field location then writes to specific field
205 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
206 //! @return void
207 void set_LTC6947_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
208  uint8_t f, //!< SPI field number
209  long field_data //!< Value field value to be set to
210  );
211 
212 
213 /* ------------------------------------------------------------------------- */
214 //! Writes values to ALL LTC6947 RW addresses
215 //! @return void
216 void set_LTC6947_ALLREGS(uint8_t cs, //!< Chip Select Pin
217  uint8_t reg01, //!< LTC6947 register 1
218  uint8_t reg02, //!< LTC6947 register 2
219  uint8_t reg03, //!< LTC6947 register 3
220  uint8_t reg04, //!< LTC6947 register 4
221  uint8_t reg05, //!< LTC6947 register 5
222  uint8_t reg06, //!< LTC6947 register 6
223  uint8_t reg07, //!< LTC6947 register 7
224  uint8_t reg08, //!< LTC6947 register 8
225  uint8_t reg09, //!< LTC6947 register 9
226  uint8_t reg0A, //!< LTC6947 register 10
227  uint8_t reg0B, //!< LTC6947 register 11
228  uint8_t reg0C, //!< LTC6947 register 12
229  uint8_t reg0D //!< LTC6947 register 13
230  );
231 
232 /* ------------------------------------------------------------------------- */
233 //! Initializes the SPI MAP arrays
234 //! The values set in initialization are used for all the LTC6947 SPI/WRITE and
235 //! read functions (set_LTC6947_SPI_FIELD, get_LTC6947_SPI_FIELD,
236 //! LTC6947_read, LTC6947_write, etc, etc)
237 //! @return void
238 void LTC6947_init();
239 
240 
241 /* ------------------------------------------------------------------------- */
242 //! returns # of addresses in parts register map (array size)
243 //! @return # of addresses in parts register map
244 uint8_t get_LTC6947_REGSIZE();
245 
246 
247 /* ------------------------------------------------------------------------- */
248 //! returns the number of bits for a given field name in the SPI map
249 //! @return the number of bits for a given field name in the SPI map
250 uint8_t get_LTC6947_SPI_FIELD_NUMBITS(uint8_t f //!< SPI field number
251  );
252 
253 
254 /* ------------------------------------------------------------------------- */
255 //! returns if the given field name is (0)read/write or (1)read_only field
256 //! @return if the given field is a (0)read/write or (1)read_only field
257 uint8_t get_LTC6947_SPI_FIELD_RW(uint8_t f //!< SPI field number
258  ) ;
259 
260 
261 /* ------------------------------------------------------------------------- */
262 //! calculates the output divider setting based on the frf and on board
263 //! VCO frequencies of LTC6947
264 //! @return odiv = 1-6 divider setting for valid frequency, or 999 for invalid frequency
265 unsigned long LTC6947_calc_odiv(unsigned long frf[2] //!< output frequency
266  );
267 
268 /* ------------------------------------------------------------------------- */
269 //! FUNCTION: LTC6947_set_frf
270 //! Calculates the integer (N), fractional (NUM) and output divider (OD) SPI values
271 //! using self created 64bit math functions.
272 //!
273 //! Datasheet equations:
274 //! - fvco = fpfd*(N + F)
275 //! - frf = fvco/O
276 //! - fpfd = fref/R
277 //! - F=NUM/2^18 = NUM/262144
278 //!
279 //! can be modified to the following equations:
280 //! - N = (int) (fvco/fpfd) = (int) frf*O*R/fref
281 //! - NUM = (int) [262144 * (frf*O*R/fref -N)]
282 //!
283 //! where:
284 //! - N = ndiv, O= odiv, NUM=fracN_num in the code below
285 //!
286 //! Linduino One (Arduino Uno) is limited to 32 bit floats/double/long.
287 //! 32 bit math functions will create rounding errors with the above equations,
288 //! that can result in frequency errors.
289 //! Therefore, the following code uses self created 64bit functions for 64bit integer math.
290 //!
291 //! - frf (33 bits) LTC6947 max frf/fvco = 6GHZ, which is 33 bit number (2^33 = 8.59G)
292 //! - fref (23 bits) LTC6947 min fref = 10MHz, which is a 23 bit number (2^23 = 8.3M)
293 //! - O (3 bits)
294 //! - R (5 bits)
295 //!
296 //! step 1: create 64 bit frf and fref numbers
297 //!
298 //! step 2: calculate O (output divider)
299 //!
300 //! step 3: get current R-divider setting
301 //!
302 //! step 4: calculate frf*O*R
303 //! max bit count/resolution: 33b+3b+5b= 41b
304 //!
305 //! step 5: calculate N(10b), using value from step 1
306 //! N = (int) frf*O*R/fref
307 //! max bit count/resolution: 41b-23b = 18b
308 //!
309 //! step 6: calculate NUM (18b)
310 //! - NUM = (int) [262144 * (frf*O*R/fref -N)]
311 //! - NUM = (int) [2^18 * (frf*O*R/fref -N)]
312 //!
313 //! to get the correct value the above calculation are performed like this
314 //! - NUM =((int)((frf*O*R/fref)<<23) - N<<23 + rounding) >> 5, where << & >> are bit shift left, right
315 //! - note 1: << 23b was chosen, because step one use 41b, 41b +23b = 64b (max number for 64 bit math)
316 //! - note 2: >> 5 was chosen because 23-5 = 2^18, which is the same as multiplying by 262144
317 //! - note 3: the rounding variable is equivalent to adding 0.5 to the NUM number. the integer operation always
318 //! rounds down, so adding a 0.5 to the number before rounding down ensures the closest value is selected.
319 //! In this function the lower 5 bits of (frf*O*R/fref)<<23) - N<<23 (possible variable 0-31)
320 //! are check to see if they are >=16.
321 //! If they are then 16 is added to this number before performing the int and >>5 functions.
322 //! @return void
323 void LTC6947_set_frf();
324 
325 
326 /* ------------------------------------------------------------------------- */
327 //! sets globals LTC6947_Fref_MHz and LTC6947_Fref_Hz
328 //! @return void
329 void set_LTC6947_global_fref(unsigned long fref_MHz, unsigned long fref_Hz);
330 
331 
332 /* ------------------------------------------------------------------------- */
333 //! sets globals LTC6947_Frf_MHz and LTC6947_Frf_Hz
334 //! @return void
335 void set_LTC6947_global_frf(unsigned long frf_MHz, unsigned long frf_Hz);
336 
337 /* ------------------------------------------------------------------------- */
338 //! sets globals LTC6947_VCO_Max_Freq_MHz, LTC6947_VCO_Max_Freq_Hz, LTC6947_VCO_Min_Freq_MHz and LTC6947_VCO_Min_Freq_Hz
339 //! @return void
340 void set_LTC6947_global_vcolim(unsigned long fvco_max_MHz, unsigned long fvco_max_Hz, unsigned long fvco_min_MHz, unsigned long fvco_min_Hz);
341 
342 
343 /* ------------------------------------------------------------------------- */
344 //! returns global LTC6947_Fref_MHz
345 //! @return LTC6947_Fref_MHz
346 unsigned long get_LTC6947_global_fref_MHz();
347 
348 
349 /* ------------------------------------------------------------------------- */
350 //! returns global LTC6947_Fref_Hz
351 //! @return LTC6947_Fref_Hz
352 unsigned long get_LTC6947_global_fref_Hz();
353 
354 
355 /* ------------------------------------------------------------------------- */
356 //! returns global LTC6947_Frf_MHz
357 //! @return LTC6947_Frf_MHz
358 unsigned long get_LTC6947_global_frf_MHz();
359 
360 
361 /* ------------------------------------------------------------------------- */
362 //! returns global LTC6947_Frf_Hz
363 //! @return LTC6947_Frf_Hz
364 unsigned long get_LTC6947_global_frf_Hz();
365 
366 
367 /* ------------------------------------------------------------------------- */
368 //! returns global LTC6947_VCO_Max_Freq_MHz
369 //! @return LTC6947_VCO_Max_Freq_MHz
370 unsigned long get_LTC6947_global_VCO_MAX_MHz();
371 
372 
373 /* ------------------------------------------------------------------------- */
374 //! returns global LTC6947_VCO_Min_Freq_MHz
375 //! @return LTC6947_VCO_Min_Freq_MHz
376 unsigned long get_LTC6947_global_VCO_MIN_MHz();
377 
378 
379 /* ------------------------------------------------------------------------- */
380 //! returns global LTC6947_VCO_Max_Freq_Hz
381 //! @return LTC6947_VCO_Max_Freq_Hz
382 unsigned long get_LTC6947_global_VCO_MAX_Hz();
383 
384 
385 /* ------------------------------------------------------------------------- */
386 //! returns global LTC6947_VCO_Min_Freq_Hz
387 //! @return LTC6947_VCO_Min_Freq_Hz
388 unsigned long get_LTC6947_global_VCO_MIN_Hz();
389 
390 
391 /* ------------------------------------------------------------------------- */
392 //! create a 64 bit Hz number from
393 //! 32 bit xxxx MHz number and 32 bit yyy yyy Hz number.
394 //! A) if an < 2^32 bits:
395 //! - an(upper 32b) = 0;
396 //! - an(lower 32b) = MHzPart(32b)*1MHz + HzPart (32b)
397 //!
398 //! B) if an > 2^32 bits (4,294,967,296):
399 //! - an(upper 32b) = 1
400 //! - an(lower 32b) = ((MHzPart-4294)*1MHz+HzPart)-967296
401 //! @return void
402 void HZto64(unsigned long an[], //!< 64 bit number, 1x2 32 bit array
403  unsigned long MHzPart, //!< integer in MHZ
404  unsigned long HzPart //!< integer in Hz
405  );
406 
407 /* ------------------------------------------------------------------------- */
408 //! Creates a equivalent 64 bit number from 2 32 bit numbers
409 //! - an[0]=bigPart upper 32 bits
410 //! - an[1]=littlePart lower 32 bits
411 //! @return void
412 void init64(unsigned long an[], //!< 64 bit number, 1x2 32 bit array
413  unsigned long bigPart, //!< upper 32 bits
414  unsigned long littlePart //!< lower 32 bits
415  );
416 
417 /* ------------------------------------------------------------------------- */
418 //! Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
419 //! @return void
420 void shl64(unsigned long an[] //!< an[] = an[]<<1
421  );
422 
423 /* ------------------------------------------------------------------------- */
424 //! Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum)
425 //! @return void
426 void shl64by(unsigned long an[], //!< an[] = an[]<<shiftnum
427  uint8_t shiftnum //!< number of bits to shift left
428  );
429 
430 /* ------------------------------------------------------------------------- */
431 //! Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
432 //! @return void
433 void shr64(unsigned long an[] //!< an[] = an[]>>shiftnum
434  );
435 
436 /* ------------------------------------------------------------------------- */
437 //! Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
438 //! @return void
439 void shr64by(unsigned long an[], //!< an[] = an[]>>shiftnum
440  uint8_t shiftnum //!< number of bits to shift right
441  );
442 
443 /* ------------------------------------------------------------------------- */
444 //! 64 bit Add ann to an (an[] = an[] + ann[])
445 //! @return void
446 void add64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
447  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
448  );
449 
450 /* ------------------------------------------------------------------------- */
451 //! 64 bit Subtract ann from an (an[] = an[] - ann[])
452 //! @return void
453 void sub64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
454  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
455  );
456 
457 /* ------------------------------------------------------------------------- */
458 //! 64 bit, if an == ann, then true
459 //! @return true, if an==ann; false, if an<>ann
460 boolean eq64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
461  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
462  );
463 
464 /* ------------------------------------------------------------------------- */
465 //! 64 bit, if an < ann, then true
466 //! @return true, if an<ann; false, if an=>ann
467 boolean lt64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
468  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
469  );
470 
471 /* ------------------------------------------------------------------------- */
472 //! 64 bit Divide, num=num/div
473 //! @return void
474 void div64(unsigned long num[], //!< numerator: 64 bit number, in 1x2 32bit array
475  unsigned long den[] //!< denominator: 64 bit number, in 1x2 32bit array
476  );
477 
478 
479 /* ------------------------------------------------------------------------- */
480 //! 64 bit multiply, an=an*ann
481 //! @return void
482 void mul64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
483  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
484  );
485 
486 /* ------------------------------------------------------------------------- */
487 //! Prints HEX representation of 64 bit an
488 //! @return void
489 void prt(unsigned long an[] //!< 64 bit number, in 1x2 32bit array
490  );
491 
492 #endif // LTC6947_H
boolean eq64(unsigned long an[], unsigned long ann[])
64 bit, if an == ann, then true
Definition: LTC6945.cpp:838
unsigned long get_LTC6947_global_fref_Hz()
returns global LTC6947_Fref_Hz
Definition: LTC6947.cpp:493
uint8_t LTC6947_read(uint8_t cs, int8_t address)
LTC6947 Read Single Address reads 8 bit Data field to LTC6947.
Definition: LTC6947.cpp:98
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 LTC6947_init()
Initializes the SPI MAP arrays The values set in initialization are used for all the LTC6947 SPI/WRIT...
Definition: LTC6947.cpp:302
void mul64(unsigned long an[], unsigned long ann[])
64 bit multiply, an=an*ann
Definition: LTC6945.cpp:906
void set_LTC6947_global_frf(unsigned long frf_MHz, unsigned long frf_Hz)
sets globals LTC6947_Frf_MHz and LTC6947_Frf_Hz
Definition: LTC6947.cpp:472
void set_LTC6947_global_vcolim(unsigned long fvco_max_MHz, unsigned long fvco_max_Hz, unsigned long fvco_min_MHz, unsigned long fvco_min_Hz)
sets globals LTC6947_VCO_Max_Freq_MHz, LTC6947_VCO_Max_Freq_Hz, LTC6947_VCO_Min_Freq_MHz and LTC6947_...
Definition: LTC6947.cpp:478
long get_LTC6947_SPI_FIELD(uint8_t cs, uint8_t f)
Gets the LTC6947 SPI field value calls function LTC6947_read_field, which reads specific address loca...
Definition: LTC6947.cpp:154
unsigned long LTC6947_calc_odiv(unsigned long frf[2])
calculates the output divider setting based on the frf and on board VCO frequencies of LTC6947 ...
Definition: LTC6947.cpp:534
void shl64by(unsigned long an[], uint8_t shiftnum)
Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum)
Definition: LTC6945.cpp:774
unsigned long get_LTC6947_global_frf_MHz()
returns global LTC6947_Frf_MHz
Definition: LTC6947.cpp:498
uint8_t get_LTC6947_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
Definition: LTC6947.cpp:242
void set_LTC6947_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)
Writes values to ALL LTC6947 RW addresses.
Definition: LTC6947.cpp:275
void shr64(unsigned long an[])
Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
Definition: LTC6945.cpp:761
boolean lt64(unsigned long an[], unsigned long ann[])
64 bit, if an < ann, then true
Definition: LTC6945.cpp:848
void shr64by(unsigned long an[], uint8_t shiftnum)
Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
Definition: LTC6945.cpp:792
static uint8_t address
Definition: DC2091A.ino:83
unsigned long get_LTC6947_global_fref_MHz()
returns global LTC6947_Fref_MHz
Definition: LTC6947.cpp:488
uint8_t get_LTC6947_REGSIZE()
returns # of addresses in parts register map (array size)
Definition: LTC6947.cpp:232
unsigned long get_LTC6947_global_VCO_MAX_MHz()
returns global LTC6947_VCO_Max_Freq_MHz
Definition: LTC6947.cpp:508
void shl64(unsigned long an[])
Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
Definition: LTC6945.cpp:748
void set_LTC6947_SPI_FIELD(uint8_t cs, uint8_t f, long field_data)
Sets the LTC6947 SPI field value calls function LTC6947_read_field, which reads specific address/fiel...
Definition: LTC6947.cpp:265
void add64(unsigned long an[], unsigned long ann[])
64 bit Add ann to an (an[] = an[] + ann[])
Definition: LTC6945.cpp:810
unsigned long get_LTC6947_global_VCO_MIN_MHz()
returns global LTC6947_VCO_Min_Freq_MHz
Definition: LTC6947.cpp:513
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
uint8_t LTC6947_write_field(uint8_t cs, long field_data, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6947 Write Single Field For SPI FIELDS in 1 or multiple address locations reads specific address/f...
Definition: LTC6947.cpp:181
void prt(unsigned long an[])
Prints HEX representation of 64 bit an.
Definition: LTC6945.cpp:698
void LTC6947_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6947 Write Single Address writes 8 bit Data field to LTC6947.
Definition: LTC6947.cpp:165
uint8_t get_LTC6947_SPI_FIELD_RW(uint8_t f)
returns if the given field name is (0)read/write or (1)read_only field
Definition: LTC6947.cpp:252
void div64(unsigned long num[], unsigned long den[])
64 bit Divide, num=num/div
Definition: LTC6945.cpp:859
void sub64(unsigned long an[], unsigned long ann[])
64 bit Subtract ann from an (an[] = an[] - ann[])
Definition: LTC6945.cpp:823
unsigned long get_LTC6947_global_VCO_MAX_Hz()
returns global LTC6947_VCO_Max_Freq_Hz
Definition: LTC6947.cpp:518
unsigned long get_LTC6947_global_VCO_MIN_Hz()
returns global LTC6947_VCO_Min_Freq_Hz
Definition: LTC6947.cpp:523
long LTC6947_read_field(uint8_t cs, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6947 Read Single Field For SPI FIELDS located in 1 or multiple address location reads specific add...
Definition: LTC6947.cpp:118
unsigned long get_LTC6947_global_frf_Hz()
returns global LTC6947_Frf_Hz
Definition: LTC6947.cpp:503
void LTC6947_set_frf()
FUNCTION: LTC6947_set_frf Calculates the integer (N), fractional (NUM) and output divider (OD) SPI va...
Definition: LTC6947.cpp:623
void set_LTC6947_global_fref(unsigned long fref_MHz, unsigned long fref_Hz)
sets globals LTC6947_Fref_MHz and LTC6947_Fref_Hz
Definition: LTC6947.cpp:466