Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC6948.h
Go to the documentation of this file.
1 /*!
2  LTC6948: Ultralow Noise and Spurious 0.37GHz to 6.39GHz FracN Synthesizer with Integrated VCO
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/LTC6948
26 
27 http://www.linear.com/product/LTC6948#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 LTC6948
66  Header for LTC6948: Ultralow Noise and Spurious 0.37GHz to 6.39GHz FracN Synthesizer with Integrated VCO
67 */
68 
69 #ifndef LTC6948_H
70 
71 #define LTC6948_H
72 
73 
74 //! Define the SPI CS pin
75 #ifndef LTC6948_CS
76 #define LTC6948_CS QUIKEVAL_CS //! SPI Chip Select Pin
77 #endif
78 
79 
80 /*! @name LTC6948 Registers Fields in Alphabetical Order */
81 #define LTC6948_ALCCAL 1 //!< for spi_map array, defines location for field specific information used to create the spi map
82 #define LTC6948_ALCEN 2 //!< for spi_map array, defines location for field specific information used to create the spi map
83 #define LTC6948_ALCHI 3 //!< for spi_map array, defines location for field specific information used to create the spi map
84 #define LTC6948_ALCLO 4 //!< for spi_map array, defines location for field specific information used to create the spi map
85 #define LTC6948_ALCMON 5 //!< for spi_map array, defines location for field specific information used to create the spi map
86 #define LTC6948_ALCULOK 6 //!< for spi_map array, defines location for field specific information used to create the spi map
87 #define LTC6948_AUTOCAL 7 //!< for spi_map array, defines location for field specific information used to create the spi map
88 #define LTC6948_AUTORST 8 //!< for spi_map array, defines location for field specific information used to create the spi map
89 #define LTC6948_BD 9 //!< for spi_map array, defines location for field specific information used to create the spi map
90 #define LTC6948_BST 10 //!< for spi_map array, defines location for field specific information used to create the spi map
91 #define LTC6948_CAL 11 //!< for spi_map array, defines location for field specific information used to create the spi map
92 #define LTC6948_CP 12 //!< for spi_map array, defines location for field specific information used to create the spi map
93 #define LTC6948_CPCHI 13 //!< for spi_map array, defines location for field specific information used to create the spi map
94 #define LTC6948_CPCLO 14 //!< for spi_map array, defines location for field specific information used to create the spi map
95 #define LTC6948_CPDN 15 //!< for spi_map array, defines location for field specific information used to create the spi map
96 #define LTC6948_CPINV 16 //!< for spi_map array, defines location for field specific information used to create the spi map
97 #define LTC6948_CPLE 17 //!< for spi_map array, defines location for field specific information used to create the spi map
98 #define LTC6948_CPMID 18 //!< for spi_map array, defines location for field specific information used to create the spi map
99 #define LTC6948_CPRST 19 //!< for spi_map array, defines location for field specific information used to create the spi map
100 #define LTC6948_CPUP 20 //!< for spi_map array, defines location for field specific information used to create the spi map
101 #define LTC6948_CPWIDE 21 //!< for spi_map array, defines location for field specific information used to create the spi map
102 #define LTC6948_DITHEN 22 //!< for spi_map array, defines location for field specific information used to create the spi map
103 #define LTC6948_FILT 23 //!< for spi_map array, defines location for field specific information used to create the spi map
104 #define LTC6948_INTN 24 //!< for spi_map array, defines location for field specific information used to create the spi map
105 #define LTC6948_LDOEN 25 //!< for spi_map array, defines location for field specific information used to create the spi map
106 #define LTC6948_LDOV 26 //!< for spi_map array, defines location for field specific information used to create the spi map
107 #define LTC6948_LKCT 27 //!< for spi_map array, defines location for field specific information used to create the spi map
108 #define LTC6948_LKWIN 28 //!< for spi_map array, defines location for field specific information used to create the spi map
109 #define LTC6948_LOCK 29 //!< for spi_map array, defines location for field specific information used to create the spi map
110 #define LTC6948_MTCAL 30 //!< for spi_map array, defines location for field specific information used to create the spi map
111 #define LTC6948_ND 31 //!< for spi_map array, defines location for field specific information used to create the spi map
112 #define LTC6948_NUM 32 //!< for spi_map array, defines location for field specific information used to create the spi map
113 #define LTC6948_OD 33 //!< for spi_map array, defines location for field specific information used to create the spi map
114 #define LTC6948_OMUTE 34 //!< for spi_map array, defines location for field specific information used to create the spi map
115 #define LTC6948_PART 35 //!< for spi_map array, defines location for field specific information used to create the spi map
116 #define LTC6948_PDALL 36 //!< for spi_map array, defines location for field specific information used to create the spi map
117 #define LTC6948_PDFN 37 //!< for spi_map array, defines location for field specific information used to create the spi map
118 #define LTC6948_PDOUT 38 //!< for spi_map array, defines location for field specific information used to create the spi map
119 #define LTC6948_PDPLL 39 //!< for spi_map array, defines location for field specific information used to create the spi map
120 #define LTC6948_PDVCO 40 //!< for spi_map array, defines location for field specific information used to create the spi map
121 #define LTC6948_POR 41 //!< for spi_map array, defines location for field specific information used to create the spi map
122 #define LTC6948_RD 42 //!< for spi_map array, defines location for field specific information used to create the spi map
123 #define LTC6948_REV 43 //!< for spi_map array, defines location for field specific information used to create the spi map
124 #define LTC6948_RFO 44 //!< for spi_map array, defines location for field specific information used to create the spi map
125 #define LTC6948_RSTFN 45 //!< for spi_map array, defines location for field specific information used to create the spi map
126 #define LTC6948_SEED 46 //!< for spi_map array, defines location for field specific information used to create the spi map
127 #define LTC6948_THI 47 //!< for spi_map array, defines location for field specific information used to create the spi map
128 #define LTC6948_TLO 48 //!< for spi_map array, defines location for field specific information used to create the spi map
129 #define LTC6948_UNLOK 49 //!< for spi_map array, defines location for field specific information used to create the spi map
130 #define LTC6948_x 50 //!< for spi_map array, defines location for field specific information used to create the spi map
131 
132 
133 #define LTC6948_NUM_REGADDR 15 //!< Defines number of LTC6948 SPI registers, used in spi_map array
134 #define LTC6948_NUM_REGFIELD 50 //!< Defines number of LTC6948 SPI fields, used in spi_map array
135 
136 #define ADDRx 0 //!< used for 2nd dim of 2d spi_map array
137 #define DxMSB 1 //!< used for 2nd dim of 2d spi_map array
138 #define NUMBITS 2 //!< used for 2nd dim of 2d spi_map array
139 #define R_ONLY 3 //!< used for 2nd dim of 2d spi_map array
140 
141 #define OneMHz 1000000L //!< 1MHz in long format, used in 64 bit math
142 
143 #define LTC6948_1_MAXFREQ 3740 //!< LTC6948-1 upper freq limit
144 #define LTC6948_2_MAXFREQ 4910 //!< LTC6948-2 upper freq limit
145 #define LTC6948_3_MAXFREQ 5790 //!< LTC6948-3 upper freq limit
146 #define LTC6948_4_MAXFREQ 6390 //!< LTC6948-4 upper freq limit
147 
148 #define LTC6948_1_MINFREQ 2240 //!< LTC6948-1 lower freq limit
149 #define LTC6948_2_MINFREQ 3080 //!< LTC6948-2 lower freq limit
150 #define LTC6948_3_MINFREQ 3840 //!< LTC6948-3 lower freq limit
151 #define LTC6948_4_MINFREQ 4200 //!< LTC6948-4 lower freq limit
152 
153 #define LTC6948_MIN_REF_FREQ 10 //!< LTC6948 lower reference frequency limit
154 #define LTC6948_MAX_REF_FREQ 425 //!< LTC6948 upper reference frequency limit
155 
156 //! @} */
157 
158 /* ------------------------------------------------------------------------- */
159 //! LTC6948 Read Single Address
160 //! reads 8 bit Data field to LTC6948.
161 //! has to shift data by one bit to account for RW bit
162 //! @return data that was read from address
163 uint8_t LTC6948_read(uint8_t cs, //!< Chip Select Pin
164  int8_t address //!< Register address for the LTC6948.
165  );
166 
167 
168 /* ------------------------------------------------------------------------- */
169 //! LTC6948 Read Single Field
170 //! For SPI FIELDS located in 1 or multiple address locations
171 //! reads specific address locations
172 //! identifies and returns specific field in question
173 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
174 //! @return data that was read from field
175 long LTC6948_read_field(uint8_t cs, //!< Chip Select Pin
176  uint8_t address, //!< Register address for the LTC6948.
177  uint8_t MSB_loc, //!< MSB bit location of field
178  uint8_t numbits //!< length of field (i.e. number of bits in field)
179  );
180 
181 
182 /* ------------------------------------------------------------------------- */
183 //! Gets the LTC6948 SPI field value
184 //! calls function LTC6948_read_field, which
185 //! reads specific address locations
186 //! identifies and returns specific field in question
187 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
188 //! @return data that was read from field
189 long get_LTC6948_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
190  uint8_t f //!< SPI field number
191  );
192 
193 
194 /* ------------------------------------------------------------------------- */
195 //! LTC6948 Write Single Address
196 //! writes 8 bit Data field to LTC6948.
197 //! has to shift data by one bit to account for RW bit
198 //! @return void
199 void LTC6948_write(uint8_t cs, //!< Chip Select Pin
200  uint8_t address, //!< Register address for the LTC6948.
201  uint8_t Data //!< 8-bit data to be written to register
202  );
203 
204 
205 /* ------------------------------------------------------------------------- */
206 //! LTC6948 Write Single Field
207 //! For SPI FIELDS in 1 or multiple address locations
208 //! reads specific address/field location then writes to specific field
209 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
210 //! @return void
211 uint8_t LTC6948_write_field(uint8_t cs, //!< Chip Select Pin
212  long field_data, //!< Value field value to be set to
213  uint8_t address, //!< Register address for the LTC6948.
214  uint8_t MSB_loc, //!< MSB bit location of field
215  uint8_t numbits //!< length of field (i.e. number of bits in field)
216  );
217 
218 
219 /* ------------------------------------------------------------------------- */
220 //! Sets the LTC6948 SPI field value
221 //! calls function LTC6948_read_field, which
222 //! reads specific address/field location then writes to specific field
223 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
224 //! @return void
225 void set_LTC6948_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
226  uint8_t f, //!< SPI field number
227  long field_data //!< Value field value to be set to
228  );
229 
230 
231 /* ------------------------------------------------------------------------- */
232 //! Writes values to ALL LTC6948 RW address
233 //! @return void
234 void set_LTC6948_ALLREGS(uint8_t cs, //!< Chip Select Pin
235  uint8_t reg01, //!< LTC6948 register 1
236  uint8_t reg02, //!< LTC6948 register 2
237  uint8_t reg03, //!< LTC6948 register 3
238  uint8_t reg04, //!< LTC6948 register 4
239  uint8_t reg05, //!< LTC6948 register 5
240  uint8_t reg06, //!< LTC6948 register 6
241  uint8_t reg07, //!< LTC6948 register 7
242  uint8_t reg08, //!< LTC6948 register 8
243  uint8_t reg09, //!< LTC6948 register 9
244  uint8_t reg0A, //!< LTC6948 register 10
245  uint8_t reg0B, //!< LTC6948 register 11
246  uint8_t reg0C, //!< LTC6948 register 12
247  uint8_t reg0D //!< LTC6948 register 13
248  );
249 
250 /* ------------------------------------------------------------------------- */
251 //! Initializes the SPI MAP arrays
252 //! The values set in initialization are used all the LTC6948 SPI/WRITE and
253 //! read functions (set_LTC6948_SPI_FIELD, get_LTC6948_SPI_FIELD,
254 //! LTC6948_read, LTC6948_write, etc, etc)
255 //! @return void
256 void LTC6948_init();
257 
258 
259 /* ------------------------------------------------------------------------- */
260 //! returns # of addresses in parts register map (array size)
261 //! @return # of addresses in parts register map
262 uint8_t get_LTC6948_REGSIZE();
263 
264 
265 /* ------------------------------------------------------------------------- */
266 //! returns the number of bits for a given field name in the SPI map
267 //! @return the number of bits for a given field name in the SPI map
268 uint8_t get_LTC6948_SPI_FIELD_NUMBITS(uint8_t f //!< SPI field number
269  );
270 
271 
272 /* ------------------------------------------------------------------------- */
273 //! returns if the given field name is (0)read/write or (1)read_only field
274 //! @return if the given field is a (0)read/write or (1)read_only field
275 uint8_t get_LTC6948_SPI_FIELD_RW(uint8_t f //!< SPI field number
276  ) ;
277 
278 
279 /* ------------------------------------------------------------------------- */
280 //! calculates the output divider setting based on the frf and version of LTC6948
281 //! @return odiv = 1-6 divider setting for valid frequency, or 999 for invalid frequency
282 unsigned long LTC6948_calc_odiv(char part_version[], //!< LTC6948 part number LTC6948-x
283  unsigned long frf[2] //!< output frequency
284  );
285 
286 /* ------------------------------------------------------------------------- */
287 //! FUNCTION: LTC6948_set_frf
288 //! Calculates the integer (N), fractional (NUM) and output divider (OD) SPI values
289 //! using self created 64bit math functions.
290 //!
291 //! Datasheet equations:
292 //! - fvco = fpfd*(N + F)
293 //! - frf = fvco/O
294 //! - fpfd = fref/R
295 //! - F=NUM/2^18 = NUM/262144
296 //!
297 //! can be modified to the following equations:
298 //! - N = (int) (fvco/fpfd) = (int) frf*O*R/fref
299 //! - NUM = (int) [262144 * (frf*O*R/fref -N)]
300 //!
301 //! where:
302 //! - N = ndiv, O= odiv, NUM=fracN_num in the code below
303 //!
304 //! Linduino One (Arduino Uno) is limited to 32 bit floats/double/long.
305 //! 32 bit math functions will create rounding errors with the above equations,
306 //! that can result in frequency errors.
307 //! Therefore, the following code uses self created 64bit functions for 64bit integer math.
308 //!
309 //! - frf (33 bits) LTC6948-4 max frf/fvco = 6.4GHZ, which is 33 bit number (2^33 = 8.59G)
310 //! - fref (23 bits) LTC6948 min fref = 10MHz, which is a 23 bit number (2^23 = 8.3M)
311 //! - O (3 bits)
312 //! - R (5 bits)
313 //!
314 //! step 1: create 64 bit frf and fref numbers
315 //!
316 //! step 2: calculate O (output divider)
317 //!
318 //! step 3: get current R-divider setting
319 //!
320 //! step 4: calculate frf*O*R
321 //! max bit count/resolution: 33b+3b+5b= 41b
322 //!
323 //! step 5: calculate N(10b), using value from step 1
324 //! N = (int) frf*O*R/fref
325 //! max bit count/resolution: 41b-23b = 18b
326 //!
327 //! step 6: calculate NUM (18b)
328 //! - NUM = (int) [262144 * (frf*O*R/fref -N)]
329 //! - NUM = (int) [2^18 * (frf*O*R/fref -N)]
330 //!
331 //! to get the correct value the above calculation are performed like this
332 //! - NUM =((int)((frf*O*R/fref)<<23) - N<<23 + rounding) >> 5, where << & >> are bit shift left, right
333 //! - note 1: << 23b was chosen, because step one use 41b, 41b +23b = 64b (max number for 64 bit math)
334 //! - note 2: >> 5 was chosen because 23-5 = 2^18, which is the same as multiplying by 262144
335 //! - note 3: the rounding variable is equivalent to adding 0.5 to the NUM number. the integer operation always
336 //! rounds down, so adding a 0.5 to the number before rounding down ensures the closest value is selected.
337 //! In this function the lower 5 bits of (frf*O*R/fref)<<23) - N<<23 (possible variable 0-31)
338 //! are check to see if they are >=16.
339 //! If they are then 16 is added to this number before performing the int and >>5 functions.
340 //! @return void
341 void LTC6948_set_frf(char part_version[] //!< LTC6948 part number LTC6948-x
342  );
343 
344 
345 /* ------------------------------------------------------------------------- */
346 //! sets globals LTC6948_Fref_MHz and LTC6948_Fref_Hz
347 //! @return void
348 void set_LTC6948_global_fref(unsigned long fref_MHz, unsigned long fref_Hz);
349 
350 
351 /* ------------------------------------------------------------------------- */
352 //! sets globals LTC6948_Frf_MHz and LTC6948_Frf_Hz
353 //! @return void
354 void set_LTC6948_global_frf(unsigned long frf_MHz, unsigned long frf_Hz);
355 
356 
357 /* ------------------------------------------------------------------------- */
358 //! returns global LTC6948_Fref_MHz
359 //! @return LTC6948_Fref_MHz
360 unsigned long get_LTC6948_global_fref_MHz();
361 
362 
363 /* ------------------------------------------------------------------------- */
364 //! returns global LTC6948_Fref_Hz
365 //! @return LTC6948_Fref_Hz
366 unsigned long get_LTC6948_global_fref_Hz();
367 
368 
369 /* ------------------------------------------------------------------------- */
370 //! returns global LTC6948_Frf_MHz
371 //! @return LTC6948_Frf_MHz
372 unsigned long get_LTC6948_global_frf_MHz();
373 
374 
375 /* ------------------------------------------------------------------------- */
376 //! returns global LTC6948_Frf_Hz
377 //! @return LTC6948_Frf_Hz
378 unsigned long get_LTC6948_global_frf_Hz();
379 
380 
381 /* ------------------------------------------------------------------------- */
382 //! create a 64 bit Hz number from
383 //! 32 bit xxxx MHz number and 32 bit yyy yyy Hz number.
384 //! A) if an < 2^32 bits:
385 //! - an(upper 32b) = 0;
386 //! - an(lower 32b) = MHzPart(32b)*1MHz + HzPart (32b)
387 //!
388 //! B) if an > 2^32 bits (4,294,967,296):
389 //! - an(upper 32b) = 1
390 //! - an(lower 32b) = ((MHzPart-4294)*1MHz+HzPart)-967296
391 //! @return void
392 void HZto64(unsigned long an[], //!< 64 bit number, 1x2 32 bit array
393  unsigned long MHzPart, //!< integer in MHZ
394  unsigned long HzPart //!< integer in Hz
395  );
396 
397 
398 /* ------------------------------------------------------------------------- */
399 //! Creates a equivalent 64 bit number from 2 32 bit numbers
400 //! - an[0]=bigPart //upper 32 bits
401 //! - an[1]=littlePart //lower 32 bits
402 //! @return void
403 void init64(unsigned long an[], //!< 64 bit number, 1x2 32 bit array
404  unsigned long bigPart, //!< upper 32 bits
405  unsigned long littlePart //!< lower 32 bits
406  );
407 
408 /* ------------------------------------------------------------------------- */
409 //! Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
410 //! @return void
411 void shl64(unsigned long an[] //!< an[] = an[]<<1
412  );
413 
414 /* ------------------------------------------------------------------------- */
415 //! Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum)
416 //! @return void
417 void shl64by(unsigned long an[], //!< an[] = an[]<<shiftnum
418  uint8_t shiftnum //!< number of bits to shift left
419  );
420 
421 /* ------------------------------------------------------------------------- */
422 //! Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
423 //! @return void
424 void shr64(unsigned long an[] //!< an[] = an[]>>shiftnum
425  );
426 
427 /* ------------------------------------------------------------------------- */
428 //! Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
429 //! @return void
430 void shr64by(unsigned long an[], //!< an[] = an[]>>shiftnum
431  uint8_t shiftnum //!< number of bits to shift right
432  );
433 
434 /* ------------------------------------------------------------------------- */
435 //! 64 bit Add ann to an (an[] = an[] + ann[])
436 //! @return void
437 void add64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
438  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
439  );
440 
441 /* ------------------------------------------------------------------------- */
442 //! 64 bit Subtract ann from an (an[] = an[] - ann[])
443 //! @return void
444 void sub64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
445  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
446  );
447 
448 /* ------------------------------------------------------------------------- */
449 //! 64 bit, if an == ann, then true
450 //! @return true, if an==ann; false, if an<>ann
451 boolean eq64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
452  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
453  );
454 
455 /* ------------------------------------------------------------------------- */
456 //! 64 bit, if an < ann, then true
457 //! @return true, if an<ann; false, if an=>ann
458 boolean lt64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
459  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
460  );
461 
462 /* ------------------------------------------------------------------------- */
463 //! 64 bit Divide, num=num/div
464 //! @return void
465 void div64(unsigned long num[], //!< numerator: 64 bit number, in 1x2 32bit array
466  unsigned long den[] //!< denominator: 64 bit number, in 1x2 32bit array
467  );
468 
469 
470 /* ------------------------------------------------------------------------- */
471 //! 64 bit multiply, an=an*ann
472 //! @return void
473 void mul64(unsigned long an[], //!< 64 bit number, in 1x2 32bit array
474  unsigned long ann[] //!< 64 bit number, in 1x2 32bit array
475  );
476 
477 /* ------------------------------------------------------------------------- */
478 //! Prints HEX representation of 64 bit an
479 //! @return void
480 void prt(unsigned long an[] //!< 64 bit number, in 1x2 32bit array
481  );
482 
483 #endif // LTC6948_H
uint8_t get_LTC6948_SPI_FIELD_RW(uint8_t f)
returns if the given field name is (0)read/write or (1)read_only field
Definition: LTC6948.cpp:249
void LTC6948_init()
Initializes the SPI MAP arrays The values set in initialization are used all the LTC6948 SPI/WRITE an...
Definition: LTC6948.cpp:299
void shr64by(unsigned long an[], uint8_t shiftnum)
Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
Definition: LTC6945.cpp:792
void LTC6948_set_frf(char part_version[])
FUNCTION: LTC6948_set_frf Calculates the integer (N), fractional (NUM) and output divider (OD) SPI va...
Definition: LTC6948.cpp:659
void prt(unsigned long an[])
Prints HEX representation of 64 bit an.
Definition: LTC6945.cpp:698
boolean lt64(unsigned long an[], unsigned long ann[])
64 bit, if an < ann, then true
Definition: LTC6945.cpp:848
void LTC6948_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6948 Write Single Address writes 8 bit Data field to LTC6948.
Definition: LTC6948.cpp:162
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
static uint8_t address
Definition: DC2091A.ino:83
uint8_t get_LTC6948_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
Definition: LTC6948.cpp:239
void shl64(unsigned long an[])
Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
Definition: LTC6945.cpp:748
uint8_t LTC6948_read(uint8_t cs, int8_t address)
LTC6948 Read Single Address reads 8 bit Data field to LTC6948.
Definition: LTC6948.cpp:95
void set_LTC6948_global_fref(unsigned long fref_MHz, unsigned long fref_Hz)
sets globals LTC6948_Fref_MHz and LTC6948_Fref_Hz
Definition: LTC6948.cpp:507
unsigned long get_LTC6948_global_fref_Hz()
returns global LTC6948_Fref_Hz
Definition: LTC6948.cpp:524
void set_LTC6948_global_frf(unsigned long frf_MHz, unsigned long frf_Hz)
sets globals LTC6948_Frf_MHz and LTC6948_Frf_Hz
Definition: LTC6948.cpp:513
void set_LTC6948_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 LTC6948 RW address.
Definition: LTC6948.cpp:272
void shr64(unsigned long an[])
Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
Definition: LTC6945.cpp:761
void div64(unsigned long num[], unsigned long den[])
64 bit Divide, num=num/div
Definition: LTC6945.cpp:859
long get_LTC6948_SPI_FIELD(uint8_t cs, uint8_t f)
Gets the LTC6948 SPI field value calls function LTC6948_read_field, which reads specific address loca...
Definition: LTC6948.cpp:151
void mul64(unsigned long an[], unsigned long ann[])
64 bit multiply, an=an*ann
Definition: LTC6945.cpp:906
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
long LTC6948_read_field(uint8_t cs, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6948 Read Single Field For SPI FIELDS located in 1 or multiple address locations reads specific ad...
Definition: LTC6948.cpp:115
unsigned long get_LTC6948_global_fref_MHz()
returns global LTC6948_Fref_MHz
Definition: LTC6948.cpp:519
uint8_t LTC6948_write_field(uint8_t cs, long field_data, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6948 Write Single Field For SPI FIELDS in 1 or multiple address locations reads specific address/f...
Definition: LTC6948.cpp:178
void set_LTC6948_SPI_FIELD(uint8_t cs, uint8_t f, long field_data)
Sets the LTC6948 SPI field value calls function LTC6948_read_field, which reads specific address/fiel...
Definition: LTC6948.cpp:262
void add64(unsigned long an[], unsigned long ann[])
64 bit Add ann to an (an[] = an[] + ann[])
Definition: LTC6945.cpp:810
unsigned long get_LTC6948_global_frf_MHz()
returns global LTC6948_Frf_MHz
Definition: LTC6948.cpp:529
unsigned long get_LTC6948_global_frf_Hz()
returns global LTC6948_Frf_Hz
Definition: LTC6948.cpp:534
void sub64(unsigned long an[], unsigned long ann[])
64 bit Subtract ann from an (an[] = an[] - ann[])
Definition: LTC6945.cpp:823
uint8_t get_LTC6948_REGSIZE()
returns # of addresses in parts register map (array size)
Definition: LTC6948.cpp:229
unsigned long LTC6948_calc_odiv(char part_version[], unsigned long frf[2])
calculates the output divider setting based on the frf and version of LTC6948
Definition: LTC6948.cpp:545
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