Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
DC1846A.ino
Go to the documentation of this file.
1 /*!
2 DC1846A
3 LTC6947: Ultralow Noise and Spurious 0.35GHz to 6GHz FracN Synthesizer
4 
5 @verbatim
6 
7  Setup:
8  Set the terminal baud rate to 115200 and select the newline terminator.
9  Refer to Demo Manual DC1846A.
10  Ensure all jumpers are installed in the factory default positions.
11  Two power supplies are needed for this demo board: a 5v and a 3.3v supply.
12  The 5V powers the 5V supply and V+VCO turret.
13  A reference frequency is also needed for this demo board, refer to the
14  DC1846 Demo Manual for details.
15 
16 
17 Command Description:
18 
19  *****Main Menu*****
20  1- Load Default Settings- Loads the SPI map that is identical to file
21  LTC6947_100MHz.fracnset that is supplied with the FracNWizard and mentioned
22  in the DC1846A user's manual. It assumes a 100MHz reference input and the
23  default DC1846A BOM. It should output a 2415MHz signal on RF+/-.
24 
25  ** If you want to use a different loop filter, reference frequency or different
26  register settings. Please use FracNWizard for the loop filter design and initial
27  device setup. The register settings from FracNWizard can be entered into menu option 2.
28 
29  2- READ/WRITE to Registers Addresses- Selecting this option will cause all the registers to
30  be read, stored to variables, and displayed. The user will then have the option
31  to write to one register address at a time.
32 
33  3- READ/WRITE to Registers Fields- Selecting this option will allow the user
34  to read or write to one register field name at a time.
35 
36  4- This function calculates and programs OD, ND, NUM based on the desired Frf,
37  the reference frequency, and the current RD value. Linduino One (Arduino Uno) are
38  limited to 32 bit floats, int and doubles. Significant rounding errors are created
39  with this 32 bit limitation. Therefore, this function uses 64bit math functions
40  specifically created to overcome this limitation. After OD, ND, and NUM are programmed,
41  the program calibrates the LTC6947. If other register need change see menu 2 or menu 3.
42 
43  5- This function stores the current SPI settings in the demo boards EEPROM
44 
45  6- This function loads SPI settings from the demo boards EEPROM to the device
46 
47 USER INPUT DATA FORMAT:
48  decimal : 1024
49  hex : 0x400
50  octal : 02000 (leading 0 "zero")
51  binary : B10000000000
52  float : 1024.0
53 
54 @endverbatim
55 
56 http://www.linear.com/product/LTC6947
57 
58 http://www.linear.com/product/LTC6947#demoboards
59 
60 
61 Copyright 2018(c) Analog Devices, Inc.
62 
63 All rights reserved.
64 
65 Redistribution and use in source and binary forms, with or without
66 modification, are permitted provided that the following conditions are met:
67  - Redistributions of source code must retain the above copyright
68  notice, this list of conditions and the following disclaimer.
69  - Redistributions in binary form must reproduce the above copyright
70  notice, this list of conditions and the following disclaimer in
71  the documentation and/or other materials provided with the
72  distribution.
73  - Neither the name of Analog Devices, Inc. nor the names of its
74  contributors may be used to endorse or promote products derived
75  from this software without specific prior written permission.
76  - The use of this software may or may not infringe the patent rights
77  of one or more patent holders. This license does not release you
78  from the requirement that you obtain separate licenses from these
79  patent holders to use this software.
80  - Use of the software either in source or binary form, must be run
81  on or directly connected to an Analog Devices Inc. component.
82 
83 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
84 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
85 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
86 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
87 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
88 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
89 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
90 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
91 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
92 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
93 */
94 
95 /*! @file
96  @ingroup LTC6947
97 */
98 
99 #include <Arduino.h>
100 #include <stdint.h>
101 #include "Linduino.h"
102 #include "LT_SPI.h"
103 #include "UserInterface.h"
104 #include "LT_I2C.h"
105 #include "QuikEval_EEPROM.h"
106 #include "LTC6947.h"
107 #include <SPI.h>
108 #include <Wire.h>
109 
110 // Function Declaration
111 void print_title(); // Print the title block
112 void print_prompt(); // Print the main menu
113 void menu_1_load_default_settings(); // Sub-menus
116 void menu_4_set_frf();
117 void menu_5_store_settings();
119 
120 // Global Variables
121 static uint8_t ref_out = 0; //!< Used to keep track of reference out status
122 static int8_t demo_board_connected; //!< Demo Board Name stored in QuikEval EEPROM
123 uint8_t First_Run=0; //!< if first time through loop = 0, otherwise=1
124 
125 
126 /* ------------------------------------------------------------------------- */
127 //! Initialize Linduino
128 //! @return void
129 void setup()
130 {
131  char demo_name[] = "DC1846"; // Demo Board Name stored in QuikEval EEPROM
132  uint8_t data;
133 
134  quikeval_SPI_init(); //! Configure the spi port for 4MHz SCK
135  quikeval_SPI_connect(); //! Connect SPI to main data port
136  quikeval_I2C_init(); //! Configure the EEPROM I2C port for 100kHz
137  Serial.begin(115200); //! Initialize the serial port to the PC
138  LTC6947_init();
139  print_title();
140 
141  demo_board_connected = discover_demo_board(demo_name); //! Checks if correct demo board is connected.
142 
144  while (1); //! Does nothing if the demo board is not connected
145 
146  Serial.print(demo_board.name);
147  Serial.println(F(" was found"));
148 
149  print_prompt();
150 } // end of setup()
151 
152 
153 /* ------------------------------------------------------------------------- */
154 //! Repeats Linduino loop
155 //! @return void
156 void loop()
157 {
158  uint16_t user_command; // User input command
159 
160  if (Serial.available()) // Check for user input
161  {
162  if (First_Run==0)
163  {
164  First_Run=1;
165  }
166 
167  user_command = read_int(); //! Reads the user command
168  if (user_command != 'm')
169  Serial.println(user_command);
170 
171  switch (user_command) //! Prints the appropriate submenu
172  {
173  case 1:
175  break;
176 
177  case 2:
179  break;
180 
181  case 3:
183  break;
184 
185  case 4:
186  menu_4_set_frf();
187  break;
188 
189  case 5:
191  break;
192 
193  case 6:
195  break;
196 
197  default:
198  Serial.println(F("Incorrect Option"));
199  break;
200  } // end of switch statement
201  Serial.println(F("\n*****************************************************************"));
202  print_prompt();
203  } // end of if statement
204 } // end of loop()
205 
206 // Function Definitions
207 /* ------------------------------------------------------------------------- */
208 //! Menu 1: Load Default SPI Register Settings
209 //! This function loads the register settings referenced
210 //! in the DC1846A demo manual's quick start section.
211 //! The register settings loaded are the same as FRACN WIZARDS
212 //! fracnset files LTC6947_100MHz.fracnset
213 //! The setting loaded with this function assume the LTC6947's
214 //! reference is set to 100MHz and
215 //! the DC1846A's BOM has not been modified.
216 //! @return void
218 {
219 
220  set_LTC6947_ALLREGS(LTC6947_CS, 0x04,0x00,0x06,0x9E,0x11,0x10,0x30,0x13,0x33,0x30,0x19,0x2D,0x00);
221  Serial.println(F("Registers Have Been Written"));
222 } // end menu_1_load_default_settings function
223 
224 
225 /* ------------------------------------------------------------------------- */
226 //! Menu 2: Reads and/or Writes the SPI register address
227 //! This function reads and displays all SPI register address settings in HEX format.
228 //! It then provides an option to modify(write to) individual registers one at time
229 //!
230 //! EXAMPLE:
231 //! - 0- ADDR00 = 0x04 (read only)
232 //! - 1- ADDR01 = 0x04
233 //! - ....
234 //! - 13- ADDR0D = 0x00
235 //! - 14- ADDR0E = 0x10 (read only)
236 //! - 0 - Return to Main Menu
237 //! - Enter a command (1-13 to modify register, or '0' to return to Main Menu):
238 //! @return void
240 {
241  uint8_t i, regval, user_regval, num_reg;
242  uint16_t user_address; // User input command
243 
244  num_reg = get_LTC6947_REGSIZE();
245  user_address=1;
246 // Read/Write loop, can exit loop by choosing '0'
247  while (user_address != 0)
248  {
249  Serial.println(F("\n*****************************************************************"));
250  // Read All Registers and display results
251  for (i=0; i<num_reg; i++)
252  {
253  regval = LTC6947_read(LTC6947_CS,i);
254  Serial.print(i);
255  if (i<16)
256  Serial.print(F("- ADDR0"));
257  else
258  Serial.print(F("- ADDR"));
259  Serial.print(i, HEX);
260  Serial.print(F(" = 0x"));
261  if (regval<16) Serial.print(F("0"));
262  Serial.print(regval, HEX);
263  if ((i==0)||(i==(num_reg-1))) Serial.print(" (read only) ");
264  if (i==2) Serial.print(" (warning: if D0=1 it resets all registers. Power On Reset Bit)");
265  Serial.println("");
266  } // end for loop
267  Serial.print("0 - Return to Main Menu\n\n");
268  // User input: Select which register to modify, or return to main menu
269  Serial.print("Enter a command (1-13 to modify register, or '0' to return to Main Menu): ");
270  user_address = read_int(); //! Reads the user command
271  Serial.println(user_address);
272 
273  // User input: enter new setting for selected register
274  if (user_address >0 && user_address<(num_reg-1))
275  {
276  Serial.print("What value should ADDR");
277  Serial.print(user_address);
278  Serial.print(" be set to (ex: HEX format 0xff): ");
279  user_regval = read_int(); //! Reads the user command
280  Serial.println(user_regval);
281 
282  // writes new setting to part
283  LTC6947_write(LTC6947_CS, (uint8_t)user_address, user_regval);
284  } // end if statement
285  } // end while loop
286 } // end menu_2_RW_to_reg_addresss
287 
288 
289 /* ------------------------------------------------------------------------- */
290 //! Support function for function menu_3_RW_to_reg_field
291 //! displays current state of select field
292 //! provides user the option to write to that field or return to menu
293 //! @return field value (user input) that will be written to part
294 long field_menu_RW(long field_val, //!< current state of the selected field
295  char field_name[], //!< SPI Field name selected
296  uint8_t f //!< SPI field identifier identifies selected fields information in SPI MAP arrays
297  )
298 {
299  long usr_field_val;
300  uint8_t field_size, i;
301  long max_num=1, pow2=1;
302 
303  Serial.print("CURRENT STATE (HEX): ");
304  Serial.print(field_name);
305  Serial.print("= 0x");
306  Serial.println(field_val, HEX);
307 
308  if (get_LTC6947_SPI_FIELD_RW(f)==0)
309  {
310  field_size=get_LTC6947_SPI_FIELD_NUMBITS(f);
311  for (i=1; i<field_size; i++)
312  {
313  pow2=pow2*2;
314  max_num=max_num + pow2;
315  }
316 
317  Serial.print("What value should ");
318  Serial.print(field_name);
319  Serial.print(" be set to or type '-1' to exit: (ex: HEX format 0x00 to 0x");
320  Serial.print(max_num, HEX);
321  Serial.print(")");
322  usr_field_val = read_int(); //! Reads the user command
323 
324  if (usr_field_val>=0 && usr_field_val<=max_num)
325  {
326  Serial.println(usr_field_val);
327  return usr_field_val;
328  }
329  else
330  {
331  return field_val;
332  } // end of if statement
333  } // end of if statement
334 } // end of field_menu_RW
335 
336 
337 /* ------------------------------------------------------------------------- */
338 //! Menu 3: Reads and/or Writes individual SPI fields
339 //! This function provides the user with a list of all SPI fields.
340 //! The user can select a SPI field to read its current value.
341 //! Then the user will be provided with an option to write to that field
342 //! or return to the selection menu.
343 //!
344 //! EXAMPLE:
345 //! - 1-AUTORST 14-FILT 27-PDFN
346 //! - 2-BST 15-INTN 28-PDOUT
347 //! - ....
348 //! - 12-CPWIDE 25-PART * 38-UNLOK *
349 //! - 13-DITHEN 26-PDALL 39-x
350 //! - 0 - Return to Main Menu
351 //! - * = READ ONLY FIELD
352 //! - Enter a command (1-39 to modify register, or '0' to return to Main Menu):
353 //! @return void
355 {
356  uint8_t field_num;
357  long field_val;
358 
359  field_num=1;
360 // Read/Write loop, can exit loop by choosing 'm'
361  while (field_num != 0)
362  {
363  Serial.println(F("\n*****************************************************************"));
364  // Select Fields to read and write to
365  Serial.print(F("1-AUTORST 14-FILT 27-PDFN\n"));
366  Serial.print(F("2-BST 15-INTN 28-PDOUT\n"));
367  Serial.print(F("3-CP 16-LDOEN 29-PDPLL\n"));
368  Serial.print(F("4-CPCHI 17-LDOV 30-POR\n"));
369  Serial.print(F("5-CPCLO 18-LKCT 31-RD\n"));
370  Serial.print(F("6-CPDN 19-LKWIN 32-REV *\n"));
371  Serial.print(F("7-CPINV 20-LOCK * 33-RFO\n"));
372  Serial.print(F("8-CPLE 21-ND 34-RSTFN\n"));
373  Serial.print(F("9-CPMID 22-NUM 35-SEED\n"));
374  Serial.print(F("10-CPRST 23-OD 36-THI *\n"));
375  Serial.print(F("11-CPUP 24-OMUTE 37-TLO *\n"));
376  Serial.print(F("12-CPWIDE 25-PART * 38-UNLOK *\n"));
377  Serial.print(F("13-DITHEN 26-PDALL 39-x\n"));
378  Serial.print("0 - Return to Main Menu\n");
379  Serial.print("* = READ ONLY FIELD\n\n");
380 
381  Serial.print("Enter a command (1-39 to modify register, or '0' to return to Main Menu): ");
382  field_num = read_int(); //! Reads the user command
383  Serial.println(field_num);
384 
385  // User input: enter new setting for selected register
386  if (field_num != 0)
387  {
388  switch (field_num) //! Prints the appropriate submenu
389  {
390  case LTC6947_AUTORST:
391  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_AUTORST); // reads selected field
392  field_val=field_menu_RW(field_val,"AUTORST",LTC6947_AUTORST); // user interface control and printout
393  if (field_val>-1)
394  {
395  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_AUTORST, field_val); // updates selected field
396  }
397  break;
398 
399  case LTC6947_BST:
400  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_BST); // reads selected field
401  field_val=field_menu_RW(field_val,"BST",LTC6947_BST); // user interface control and printout
402  if (field_val>-1)
403  {
404  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_BST, field_val); // updates selected field
405  }
406  break;
407 
408  case LTC6947_CP:
409  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CP); // reads selected field
410  field_val=field_menu_RW(field_val,"CP",LTC6947_CP); // user interface control and printout
411  if (field_val>-1)
412  {
413  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CP, field_val); // updates selected field
414  }
415  break;
416 
417  case LTC6947_CPCHI:
418  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPCHI); // reads selected field
419  field_val=field_menu_RW(field_val,"CPCHI",LTC6947_CPCHI); // user interface control and printout
420  if (field_val>-1)
421  {
422  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPCHI, field_val); // updates selected field
423  }
424  break;
425 
426  case LTC6947_CPCLO:
427  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPCLO); // reads selected field
428  field_val=field_menu_RW(field_val,"CPCLO",LTC6947_CPCLO); // user interface control and printout
429  if (field_val>-1)
430  {
431  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPCLO, field_val); // updates selected field
432  }
433  break;
434 
435  case LTC6947_CPDN:
436  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPDN); // reads selected field
437  field_val=field_menu_RW(field_val,"CPDN",LTC6947_CPDN); // user interface control and printout
438  if (field_val>-1)
439  {
440  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPDN, field_val); // updates selected field
441  }
442  break;
443 
444  case LTC6947_CPINV:
445  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPINV); // reads selected field
446  field_val=field_menu_RW(field_val,"CPINV",LTC6947_CPINV); // user interface control and printout
447  if (field_val>-1)
448  {
449  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPINV, field_val); // updates selected field
450  }
451  break;
452 
453  case LTC6947_CPLE:
454  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPLE); // reads selected field
455  field_val=field_menu_RW(field_val,"CPLE",LTC6947_CPLE); // user interface control and printout
456  if (field_val>-1)
457  {
458  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPLE, field_val); // updates selected field
459  }
460  break;
461 
462  case LTC6947_CPMID:
463  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPMID); // reads selected field
464  field_val=field_menu_RW(field_val,"CPMID",LTC6947_CPMID); // user interface control and printout
465  if (field_val>-1)
466  {
467  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPMID, field_val); // updates selected field
468  }
469  break;
470 
471  case LTC6947_CPRST:
472  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPRST); // reads selected field
473  field_val=field_menu_RW(field_val,"CPRST",LTC6947_CPRST); // user interface control and printout
474  if (field_val>-1)
475  {
476  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPRST, field_val); // updates selected field
477  }
478  break;
479 
480  case LTC6947_CPUP:
481  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPUP); // reads selected field
482  field_val=field_menu_RW(field_val,"CPUP",LTC6947_CPUP); // user interface control and printout
483  if (field_val>-1)
484  {
485  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPUP, field_val); // updates selected field
486  }
487  break;
488 
489  case LTC6947_CPWIDE:
490  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_CPWIDE); // reads selected field
491  field_val=field_menu_RW(field_val,"CPWIDE",LTC6947_CPWIDE); // user interface control and printout
492  if (field_val>-1)
493  {
494  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_CPWIDE, field_val); // updates selected field
495  }
496  break;
497 
498  case LTC6947_DITHEN:
499  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_DITHEN); // reads selected field
500  field_val=field_menu_RW(field_val,"DITHEN",LTC6947_DITHEN); // user interface control and printout
501  if (field_val>-1)
502  {
503  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_DITHEN, field_val); // updates selected field
504  }
505  break;
506 
507  case LTC6947_FILT:
508  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_FILT); // reads selected field
509  field_val=field_menu_RW(field_val,"FILT",LTC6947_FILT); // user interface control and printout
510  if (field_val>-1)
511  {
512  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_FILT, field_val); // updates selected field
513  }
514  break;
515 
516  case LTC6947_INTN:
517  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_INTN); // reads selected field
518  field_val=field_menu_RW(field_val,"INTN",LTC6947_INTN); // user interface control and printout
519  if (field_val>-1)
520  {
521  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_INTN, field_val); // updates selected field
522  }
523  break;
524 
525  case LTC6947_LDOEN:
526  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_LDOEN); // reads selected field
527  field_val=field_menu_RW(field_val,"LDOEN",LTC6947_LDOEN); // user interface control and printout
528  if (field_val>-1)
529  {
530  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_LDOEN, field_val); // updates selected field
531  }
532  break;
533 
534  case LTC6947_LDOV:
535  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_LDOV); // reads selected field
536  field_val=field_menu_RW(field_val,"LDOV",LTC6947_LDOV); // user interface control and printout
537  if (field_val>-1)
538  {
539  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_LDOV, field_val); // updates selected field
540  }
541  break;
542 
543  case LTC6947_LKCT:
544  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_LKCT); // reads selected field
545  field_val=field_menu_RW(field_val,"LKCT",LTC6947_LKCT); // user interface control and printout
546  if (field_val>-1)
547  {
548  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_LKCT, field_val); // updates selected field
549  }
550  break;
551 
552  case LTC6947_LKWIN:
553  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_LKWIN); // reads selected field
554  field_val=field_menu_RW(field_val,"LKWIN",LTC6947_LKWIN); // user interface control and printout
555  if (field_val>-1)
556  {
557  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_LKWIN, field_val); // updates selected field
558  }
559  break;
560 
561  case LTC6947_LOCK:
562  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_LOCK); // reads selected field
563  field_val=field_menu_RW(field_val,"LOCK",LTC6947_LOCK); // user interface control and printout
564  if (field_val>-1)
565  {
566  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_LOCK, field_val); // updates selected field
567  }
568  break;
569 
570  case LTC6947_ND:
571  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_ND); // reads selected field
572  field_val=field_menu_RW(field_val,"ND",LTC6947_ND); // user interface control and printout
573  if (field_val>-1)
574  {
575  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_ND, field_val); // updates selected field
576  }
577  break;
578 
579  case LTC6947_NUM:
580  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_NUM); // reads selected field
581  field_val=field_menu_RW(field_val,"NUM",LTC6947_NUM); // user interface control and printout
582  if (field_val>-1)
583  {
584  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_NUM, field_val); // updates selected field
585  }
586  break;
587 
588  case LTC6947_OD:
589  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_OD); // reads selected field
590  field_val=field_menu_RW(field_val,"OD",LTC6947_OD); // user interface control and printout
591  if (field_val>-1)
592  {
593  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_OD, field_val); // updates selected field
594  }
595  break;
596 
597  case LTC6947_OMUTE:
598  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_OMUTE); // reads selected field
599  field_val=field_menu_RW(field_val,"OMUTE",LTC6947_OMUTE); // user interface control and printout
600  if (field_val>-1)
601  {
602  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_OMUTE, field_val); // updates selected field
603  }
604  break;
605 
606  case LTC6947_PART:
607  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_PART); // reads selected field
608  field_val=field_menu_RW(field_val,"PART",LTC6947_PART); // user interface control and printout
609  if (field_val>-1)
610  {
611  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_PART, field_val); // updates selected field
612  }
613  break;
614 
615  case LTC6947_PDALL:
616  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_PDALL); // reads selected field
617  field_val=field_menu_RW(field_val,"PDALL",LTC6947_PDALL); // user interface control and printout
618  if (field_val>-1)
619  {
620  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_PDALL, field_val); // updates selected field
621  }
622  break;
623 
624  case LTC6947_PDFN:
625  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_PDFN); // reads selected field
626  field_val=field_menu_RW(field_val,"PDFN",LTC6947_PDFN); // user interface control and printout
627  if (field_val>-1)
628  {
629  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_PDFN, field_val); // updates selected field
630  }
631  break;
632 
633  case LTC6947_PDOUT:
634  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_PDOUT); // reads selected field
635  field_val=field_menu_RW(field_val,"PDOUT",LTC6947_PDOUT); // user interface control and printout
636  if (field_val>-1)
637  {
638  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_PDOUT, field_val); // updates selected field
639  }
640  break;
641 
642  case LTC6947_PDPLL:
643  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_PDPLL); // reads selected field
644  field_val=field_menu_RW(field_val,"PDPLL",LTC6947_PDPLL); // user interface control and printout
645  if (field_val>-1)
646  {
647  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_PDPLL, field_val); // updates selected field
648  }
649  break;
650 
651  case LTC6947_POR:
652  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_POR); // reads selected field
653  field_val=field_menu_RW(field_val,"POR",LTC6947_POR); // user interface control and printout
654  if (field_val>-1)
655  {
656  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_POR, field_val); // updates selected field
657  }
658  break;
659 
660  case LTC6947_RD:
661  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_RD); // reads selected field
662  field_val=field_menu_RW(field_val,"RD",LTC6947_RD); // user interface control and printout
663  if (field_val>-1)
664  {
665  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_RD, field_val); // updates selected field
666  }
667  break;
668 
669  case LTC6947_REV:
670  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_REV); // reads selected field
671  field_val=field_menu_RW(field_val,"REV",LTC6947_REV); // user interface control and printout
672  if (field_val>-1)
673  {
674  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_REV, field_val); // updates selected field
675  }
676  break;
677 
678  case LTC6947_RFO:
679  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_RFO); // reads selected field
680  field_val=field_menu_RW(field_val,"RFO",LTC6947_RFO); // user interface control and printout
681  if (field_val>-1)
682  {
683  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_RFO, field_val); // updates selected field
684  }
685  break;
686 
687  case LTC6947_RSTFN:
688  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_RSTFN); // reads selected field
689  field_val=field_menu_RW(field_val,"RSTFN",LTC6947_RSTFN); // user interface control and printout
690  if (field_val>-1)
691  {
692  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_RSTFN, field_val); // updates selected field
693  }
694  break;
695 
696  case LTC6947_SEED:
697  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_SEED); // reads selected field
698  field_val=field_menu_RW(field_val,"SEED",LTC6947_SEED); // user interface control and printout
699  if (field_val>-1)
700  {
701  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_SEED, field_val); // updates selected field
702  }
703  break;
704 
705  case LTC6947_THI:
706  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_THI); // reads selected field
707  field_val=field_menu_RW(field_val,"THI",LTC6947_THI); // user interface control and printout
708  if (field_val>-1)
709  {
710  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_THI, field_val); // updates selected field
711  }
712  break;
713 
714  case LTC6947_TLO:
715  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_TLO); // reads selected field
716  field_val=field_menu_RW(field_val,"TLO",LTC6947_TLO); // user interface control and printout
717  if (field_val>-1)
718  {
719  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_TLO, field_val); // updates selected field
720  }
721  break;
722 
723  case LTC6947_UNLOK:
724  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_UNLOK); // reads selected field
725  field_val=field_menu_RW(field_val,"UNLOK",LTC6947_UNLOK); // user interface control and printout
726  if (field_val>-1)
727  {
728  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_UNLOK, field_val); // updates selected field
729  }
730  break;
731 
732  case LTC6947_x:
733  field_val=get_LTC6947_SPI_FIELD(LTC6947_CS,LTC6947_x); // reads selected field
734  field_val=field_menu_RW(field_val,"x",LTC6947_x); // user interface control and printout
735  if (field_val>-1)
736  {
737  set_LTC6947_SPI_FIELD(LTC6947_CS, LTC6947_x, field_val); // updates selected field
738  }
739  break;
740  } // end of switch statement
741  } // end if user_command != 0 statement
742  } // end while loop
743 } // end menu_3_RW_to_reg_field function
744 
745 
746 /* ------------------------------------------------------------------------- */
747 //! verifies VCO frequency is within datasheet specifications
749 {
750  unsigned long temp_val, temp_max_VCO_MHz, temp_min_VCO_MHz, temp_max_VCO_Hz, temp_min_VCO_Hz;
751  unsigned long fvco_max[2], fvco_min[2], fvco_max_lim[2], fvco_min_lim[2];
752  boolean valid_input=false;
753 
754 // USER INPUT
755  valid_input=false;
756 
757 
758  while (valid_input==false)
759  {
760  temp_max_VCO_MHz=get_LTC6947_global_VCO_MAX_MHz();
761  temp_min_VCO_MHz=get_LTC6947_global_VCO_MIN_MHz();
762  temp_max_VCO_Hz=get_LTC6947_global_VCO_MAX_Hz();
763  temp_min_VCO_Hz=get_LTC6947_global_VCO_MIN_Hz();
764 
765  Serial.print(F("What is the upper frequency limit of the VCO (MHZ portion)? ["));
766  Serial.print(temp_max_VCO_MHz);
767  Serial.print(F("]: "));
768  temp_val = read_float(); //! Reads the user command
769  // if user selects enter, keep same Fref. Otherwise set Fref and verify
770  if (temp_val!=0) temp_max_VCO_MHz = abs(temp_val);
771  Serial.println(temp_max_VCO_MHz);
772 
773  Serial.print(F("What is the upper VCO frequency limit (HZ portion)? "));
774  temp_max_VCO_Hz = read_float(); //! Reads the user command
775  // if user selects enter, keep same Fref. Otherwise set Fref and verify
776  Serial.println(temp_max_VCO_Hz);
777 
778  Serial.print(F("\nWhat is the lower frequency limit of the VCO (MHZ portion)? ["));
779  Serial.print(temp_min_VCO_MHz);
780  Serial.print(F("]: "));
781  temp_val = read_float(); //! Reads the user command
782  // if user selects enter, keep same Fref. Otherwise set Fref and verify
783  if (temp_val!=0) temp_min_VCO_MHz = abs(temp_val);
784  Serial.println(temp_min_VCO_MHz);
785 
786  Serial.print(F("What is the lower frequency limit of the VCO (HZ portion)? "));
787  temp_min_VCO_Hz = read_float(); //! Reads the user command
788  Serial.println(temp_min_VCO_Hz);
789 
790  HZto64(fvco_max,temp_max_VCO_MHz,temp_max_VCO_Hz); // convert to 64 bit integer
791  HZto64(fvco_min,temp_min_VCO_MHz,temp_min_VCO_Hz); // convert to 64 bit integer
792  HZto64(fvco_max_lim,LTC6947_MAXFREQ,0); // convert to 64 bit integer
793  HZto64(fvco_min_lim,LTC6947_MINFREQ,0); // convert to 64 bit integer
794 
795 
796  // if valid input print the following to the screen
797  if (lt64(fvco_min_lim,fvco_min) && lt64(fvco_max,fvco_max_lim) &&
798  lt64(fvco_min_lim,fvco_max) && lt64(fvco_min,fvco_max_lim) &&
799  (eq64(fvco_min, fvco_max) || lt64(fvco_min, fvco_max)) )
800  {
801  set_LTC6947_global_vcolim(temp_max_VCO_MHz, temp_max_VCO_Hz, temp_min_VCO_MHz, temp_min_VCO_Hz);
802  Serial.print(F("VCO Frequencies entered are valid\n"));
803  valid_input=true;
804  }
805  else
806  {
807  Serial.print(F("VCO Frequencies must be between 350MHz and 6000MHz\n"));
808  } // end of if-else
809  } // end of while
810 } // end of LTC6947_VCO_Freq_Verification
811 
812 
813 /* ------------------------------------------------------------------------- */
814 //! verifies reference frequency is within datasheet specifications
815 
817 {
818  unsigned long temp_val, temp_fref_MHz, temp_fref_Hz;
819  boolean valid_input=false;
820 
821 // USER INPUT
822  valid_input=false;
823 
824 
825  while (valid_input==false)
826  {
827  temp_fref_MHz=get_LTC6947_global_fref_MHz();
828  temp_fref_Hz=get_LTC6947_global_fref_Hz();
829  Serial.print(F("\nWhat is the MHz portion of the Reference Input Frequency(MHZ)? ["));
830  Serial.print(temp_fref_MHz);
831  Serial.print(F("]: "));
832  temp_val = read_float(); //! Reads the user command
833  // if user selects enter, keep same Fref. Otherwise set Fref and verify
834  if (temp_val!=0) temp_fref_MHz = abs(temp_val);
835  Serial.println(temp_fref_MHz);
836 
837  Serial.print(F("What is the sub-MHz portion of the Reference Input Frequency(HZ)? "));
838  temp_val = read_float(); //! Reads the user command
839  temp_fref_Hz = abs(temp_val);
840  Serial.println(temp_fref_Hz);
841 
842  // if valid input print the following to the screen
843  if (temp_fref_MHz >=LTC6947_MIN_REF_FREQ & temp_fref_MHz <= LTC6947_MAX_REF_FREQ)
844  {
845  set_LTC6947_global_fref(temp_fref_MHz,temp_fref_Hz);
846  temp_val= temp_fref_MHz*OneMHz + temp_fref_Hz;
847  Serial.print(F("Reference Frequency set to "));
848  Serial.print(temp_val);
849  Serial.println(F("Hz"));
850  valid_input=true;
851  }
852  else
853  {
854  Serial.print(F("Reference Frequency must be between 10MHz and 425MHz\n"));
855  } // end of if-else
856  } // end of while
857 } // end of LTC6947_Ref_Freq_Verification
858 
859 
860 /* ------------------------------------------------------------------------- */
861 //! verifies frf frequency is within datasheet specifications
863 {
864  unsigned long odiv, temp_fout_MHz, temp_fout_Hz, temp_val;
865  unsigned long frf[2];
866  boolean valid_input=false;
867 
868 // USER INPUT
869  temp_fout_MHz=get_LTC6947_global_frf_MHz();
870  temp_fout_Hz=get_LTC6947_global_frf_Hz();
871 
872  while (valid_input==false)
873  {
874  Serial.print(F("\nWhat is the MHz portion of the Output Frequency(MHZ)? ["));
875  Serial.print(temp_fout_MHz);
876  Serial.print(F("]: "));
877  temp_val = read_int(); //! Reads the user command
878  // if user selects enter, keep same Fout. Otherwise set Fout and verify
879  if (temp_val!=0) temp_fout_MHz = abs(temp_val);
880  Serial.println(temp_fout_MHz);
881 
882  Serial.print(F("What is the Hz portion of the Output Frequency(HZ)? "));
883  temp_val = read_int(); //! Reads the user command
884  temp_fout_Hz = abs(temp_val);
885  Serial.println(temp_fout_Hz);
886 
887  HZto64(frf,temp_fout_MHz,temp_fout_Hz); // convert to 64 bit integer
888 
889  // verify desired frequency falls within a divider range (1-6)
890  odiv = LTC6947_calc_odiv(frf);
891  valid_input=false;
892  if ((odiv>=1) && (odiv<=6)) valid_input=true;
893 
894  // if valid input print the following to the screen
895  if (valid_input==true)
896  {
897  set_LTC6947_global_frf(temp_fout_MHz,temp_fout_Hz);
898  if (temp_fout_MHz < 4294)
899  {
900  temp_val= temp_fout_MHz*OneMHz + temp_fout_Hz;
901  Serial.print(F("Desired Output Frequency is "));
902  Serial.print(temp_val);
903  Serial.println(F("Hz"));
904  }
905  else // over flow condition
906  {
907  Serial.print(F("Desired Output Frequency is "));
908  Serial.print(temp_fout_MHz);
909  Serial.print(F("MHz + "));
910  Serial.print(temp_fout_Hz);
911  Serial.println(F("Hz"));
912  }
913  }
914  // if invalid input print the following to the screen
915  else
916  {
917  Serial.println(F("Invalid Fout frequency chosen"));
918  } // end of if/else (valid_input==true)
919  } // end of while(valid_input=false)
920 } // end of Fout_Freq_Verification
921 
922 
923 /* ------------------------------------------------------------------------- */
924 //! Menu 4: Calculates and programs OD, ND, NUM based on desired Frf
925 //! This function calculates and programs OD, ND, NUM based on desired Frf,
926 //! the reference frequency, and current RD value.
927 //! Linduino One (Arduino Uno) are limited to 32 bit floats, int and doubles.
928 //! Significant rounding errors are created with this 32 bit limitation. Therefore,
929 //! This function uses 64bit math functions specifically created to overcome this limitation.
930 //! If RD needs to change see menu 2 or menu 3
931 //! @return void
933 {
934  Serial.print(F("\nThis function calculates and programs OD, ND, NUM\n"));
935  Serial.print(F("based on the value input for Fvco, Frf and Fref.\n"));
936  Serial.print(F("It assumes all other register settings are correct\n"));
937  Serial.print(F("The FracNWizard tool can verify the correctness of the other register settings.\n"));
938 
939 
940  Serial.print(F("\nThe following frequencies will be entered with 2 integers\n"));
941  Serial.print(F("1st number is the MHZ portion, the 2nd number is Hz portion\n"));
942  Serial.print(F(" - Example: A. 100\n"));
943  Serial.print(F(" B. 25\n"));
944  Serial.print(F(" equates to 100.000025MHZ\n\n"));
948  LTC6947_set_frf();
949 }
950 
951 /* ------------------------------------------------------------------------- */
952 //! Store PLL settings to nonvolatile EEPROM on demo board
953 //! @return void
955 {
956 // Store the PLL Settings to the EEPROM
957  uint8_t regval;
958 
959  uint8_t addr_offset;
960  uint8_t num_reg;
961 
962  addr_offset=2;
963  num_reg = get_LTC6947_REGSIZE();
964 
966 
967  for (uint8_t i = 0; i <= num_reg ; i++)
968  {
969  regval = LTC6947_read(LTC6947_CS,i);
971  }
972  Serial.println(F("PLL Settings Stored to EEPROM"));
973 
974 }
975 
976 
977 /* ------------------------------------------------------------------------- */
978 //! Read stored PLL settings from nonvolatile EEPROM on demo board
979 //! @return void
981 {
982 // Read the PLL settings from EEPROM
983  int16_t cal_key;
984  uint8_t regval;
985  uint8_t user_address;
986 
987  uint8_t addr_offset;
988  uint8_t num_reg;
989 
990  addr_offset=2;
991  num_reg = get_LTC6947_REGSIZE();
992 
993 // read the cal key from the EEPROM
995  if (cal_key == EEPROM_CAL_KEY)
996  {
997  // PLL Settings has been stored, read PLL Settings
998  user_address=2;
999  for (uint8_t i = 0; i <= num_reg ; i++)
1000  {
1001  eeprom_read_byte(EEPROM_I2C_ADDRESS,(char *) &regval, EEPROM_CAL_STATUS_ADDRESS + i+addr_offset);
1002  LTC6947_write(LTC6947_CS, (uint8_t)i, regval);
1003  user_address++;
1004  }
1005  Serial.println(F("PLL Settings Restored"));
1006  }
1007  else
1008  {
1009  Serial.println(F("PLL Settings not found"));
1010  }
1011 
1012 }
1013 
1014 /* ------------------------------------------------------------------------- */
1015 //! Prints the title block when program first starts.
1017 {
1018 
1019  Serial.println(F("*****************************************************************"));
1020  Serial.println(F("* DC1846 Demonstration Program *"));
1021  Serial.println(F("* *"));
1022  Serial.println(F("* This program demonstrates how to send data to the LTC6947 *"));
1023  Serial.println(F("* Ultra Low Noise & Spurious FracN Synthesizer. *"));
1024  Serial.println(F("* *"));
1025  Serial.println(F("* Set the baud rate to 115200 and select the newline terminator.*"));
1026  Serial.println(F("* *"));
1027  Serial.println(F("* For loop filter design please use the FracN Wizard software. *"));
1028  Serial.println(F("* - It is recommended to use FracNWizard to determine the *"));
1029  Serial.println(F("* correct SPI register values for the initial setup. These *"));
1030  Serial.println(F("* values can be entered into this program via menu option 2 *"));
1031  Serial.println(F("* below. These values can then be stored and recalled from the *"));
1032  Serial.println(F("* DC1846 EEPROM using options 5 and 6 below. *"));
1033  Serial.println(F("*****************************************************************"));
1034  Serial.println();
1035 } // end of print_title
1036 
1037 
1038 /* ------------------------------------------------------------------------- */
1039 //! Prints main menu.
1041 {
1042 
1043  Serial.println(F("\nCommand Summary:"));
1044  Serial.println(F(" 1-Load Default Settings (same as the FracN Wizard's LTC6947_100MHz.fracnset settings)"));
1045  Serial.println(F(" 2-READ/WRITE to Registers Addresses"));
1046  Serial.println(F(" 3-READ/WRITE to Registers Fields"));
1047  Serial.println(F(" 4-Set Output Frequency (Frf)"));
1048  Serial.println(F(" 5-Store LTC6947 SPI settings to the DC1846's EEPROM"));
1049  Serial.println(F(" 6-Restore LTC6947 SPI settings from the DC1846's EEPROM"));
1050  Serial.println("");
1051  Serial.print(F("Enter a command: "));
1052 } // end of print_prompt
1053 
1054 
struct demo_board_type demo_board
Instantiate demo board structure.
boolean lt64(unsigned long an[], unsigned long ann[])
64 bit, if an < ann, then true
Definition: LTC6945.cpp:848
#define LTC6947_CPCHI
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:84
#define LTC6947_ND
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:101
uint8_t eeprom_read_int16(uint8_t i2c_address, int16_t *read_data, uint16_t address)
Read the two byte integer data from the EEPROM starting at address.
unsigned long get_LTC6947_global_VCO_MIN_Hz()
returns global LTC6947_VCO_Min_Freq_Hz
Definition: LTC6947.cpp:523
unsigned char user_command
#define LTC6947_INTN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:95
#define LTC6947_PDALL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:106
#define EEPROM_I2C_ADDRESS
#define LTC6947_PDPLL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:109
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
uint8_t eeprom_write_byte(uint8_t i2c_address, char data, uint16_t address)
Write the data byte to the EEPROM with i2c_address starting at EEPROM address.
#define LTC6947_CPUP
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:91
#define LTC6947_MINFREQ
LTC6947 lower freq limit.
Definition: LTC6947.h:132
char name[15]
Demo Circuit number (DC1678)
#define LTC6947_POR
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:110
#define LTC6947_x
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:119
#define LTC6947_RSTFN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:114
#define LTC6947_BST
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:82
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
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
Header File for Linduino Libraries and Demo Code.
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
#define LTC6947_CPRST
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:90
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 LTC6947_read(uint8_t cs, int8_t address)
LTC6947 Read Single Address reads 8 bit Data field to LTC6947.
Definition: LTC6947.cpp:98
static void print_title()
Prints the title block when program first starts.
Definition: DC1846A.ino:1016
#define OneMHz
1MHz in long format, used in 64 bit math
Definition: LTC6945.h:121
boolean eq64(unsigned long an[], unsigned long ann[])
64 bit, if an == ann, then true
Definition: LTC6945.cpp:838
unsigned long get_LTC6947_global_VCO_MIN_MHz()
returns global LTC6947_VCO_Min_Freq_MHz
Definition: LTC6947.cpp:513
#define LTC6947_THI
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:116
#define LTC6947_RD
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:111
#define LTC6947_CPLE
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:88
static void menu_6_restore_settings()
Read stored PLL settings from nonvolatile EEPROM on demo board.
Definition: DC1846A.ino:980
#define LTC6947_REV
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:112
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
static void LTC6947_VCO_Freq_Verification()
verifies VCO frequency is within datasheet specifications
Definition: DC1846A.ino:748
#define LTC6947_OD
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:103
#define LTC6947_FILT
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:94
#define LTC6947_CP
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:83
union LT_union_int32_4bytes data
Definition: DC2094A.ino:138
unsigned long get_LTC6947_global_VCO_MAX_MHz()
returns global LTC6947_VCO_Max_Freq_MHz
Definition: LTC6947.cpp:508
#define LTC6947_CPMID
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:89
#define LTC6947_OMUTE
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:104
#define LTC6947_PART
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:105
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
#define LTC6947_LDOEN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:96
uint8_t eeprom_write_int16(uint8_t i2c_address, int16_t write_data, uint16_t address)
Write the 2 byte integer data to the EEPROM starting at address.
#define LTC6947_CPDN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:86
static void menu_1_load_default_settings()
Menu 1: Load Default SPI Register Settings This function loads the register settings referenced in th...
Definition: DC1846A.ino:217
void LTC6947_set_frf()
FUNCTION: LTC6947_set_frf Calculates the integer (N), fractional (NUM) and output divider (OD) SPI va...
Definition: LTC6947.cpp:623
uint8_t eeprom_read_byte(uint8_t i2c_address, char *data, uint16_t address)
Read a data byte at address from the EEPROM with i2c_address.
QuikEval EEPROM Library.
unsigned long get_LTC6947_global_frf_MHz()
returns global LTC6947_Frf_MHz
Definition: LTC6947.cpp:498
#define LTC6947_RFO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:113
unsigned long get_LTC6947_global_fref_Hz()
returns global LTC6947_Fref_Hz
Definition: LTC6947.cpp:493
static void print_prompt()
Prints main menu.
Definition: DC1846A.ino:1040
#define LTC6947_CPINV
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:87
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
Definition: LT_SPI.cpp:151
static void menu_2_RW_to_reg_addresss()
Menu 2: Reads and/or Writes the SPI register address This function reads and displays all SPI registe...
Definition: DC1846A.ino:239
#define EEPROM_CAL_STATUS_ADDRESS
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
#define LTC6947_PDFN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:107
unsigned long get_LTC6947_global_fref_MHz()
returns global LTC6947_Fref_MHz
Definition: LTC6947.cpp:488
#define LTC6947_LKWIN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:99
#define LTC6947_MAXFREQ
LTC6947 upper freq limit.
Definition: LTC6947.h:133
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
unsigned long get_LTC6947_global_VCO_MAX_Hz()
returns global LTC6947_VCO_Max_Freq_Hz
Definition: LTC6947.cpp:518
#define LTC6947_PDOUT
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:108
#define LTC6947_TLO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:117
#define LTC6947_CPWIDE
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:92
#define LTC6947_CPCLO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:85
static int8_t demo_board_connected
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1846A.ino:122
#define LTC6947_LDOV
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:97
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
#define LTC6947_UNLOK
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:118
static void menu_4_set_frf()
Menu 4: Calculates and programs OD, ND, NUM based on desired Frf This function calculates and program...
Definition: DC1846A.ino:932
LTC6947: Ultralow Noise and Spurious 0.35GHz to 6GHz FracN Synthesizer.
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
static uint8_t First_Run
if first time through loop = 0, otherwise=1
Definition: DC1846A.ino:123
#define LTC6947_LKCT
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:98
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
#define LTC6947_NUM
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:102
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
Definition: LT_SPI.cpp:138
long field_menu_RW(long field_val, char field_name[], uint8_t f)
Support function for function menu_3_RW_to_reg_field displays current state of select field provides ...
Definition: DC1846A.ino:294
static void menu_5_store_settings()
Store PLL settings to nonvolatile EEPROM on demo board.
Definition: DC1846A.ino:954
#define LTC6947_MIN_REF_FREQ
LTC6947 lower reference frequency limit.
Definition: LTC6947.h:135
int32_t read_int()
#define LTC6947_LOCK
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:100
float read_float()
#define LTC6947_SEED
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:115
#define LTC6947_DITHEN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:93
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
static void LTC6947_Ref_Freq_Verification()
verifies reference frequency is within datasheet specifications
Definition: DC1846A.ino:816
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
Definition: LT_I2C.cpp:394
static void menu_3_RW_to_reg_field()
Menu 3: Reads and/or Writes individual SPI fields This function provides the user with a list of all ...
Definition: DC1846A.ino:354
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
static int i
Definition: DC2430A.ino:184
static void setup()
Initialize Linduino.
Definition: DC1846A.ino:129
#define LTC6947_AUTORST
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6947.h:81
#define LTC6947_CS
Define the SPI CS pin.
Definition: LTC6947.h:76
uint8_t get_LTC6947_REGSIZE()
returns # of addresses in parts register map (array size)
Definition: LTC6947.cpp:232
#define EEPROM_CAL_KEY
unsigned long get_LTC6947_global_frf_Hz()
returns global LTC6947_Frf_Hz
Definition: LTC6947.cpp:503
#define LTC6947_MAX_REF_FREQ
LTC6947 upper reference frequency limit.
Definition: LTC6947.h:136
static void LTC6947_Fout_Freq_Verification()
verifies frf frequency is within datasheet specifications
Definition: DC1846A.ino:862
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
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
static uint8_t ref_out
Used to keep track of reference out status.
Definition: DC1846A.ino:121
static void loop()
Repeats Linduino loop.
Definition: DC1846A.ino:156