| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

DC1534A.ino
Go to the documentation of this file.
1 /*!
2 Linear Technology DC1534A Demonstration Board.
3 LTC2637: Octal 12-/10-/8-Bit I2C VOUT DACs with 10ppm/°C Reference.
4
5 Linear Technology DC1593A Demonstration Board.
6 LTC2635: Quad 12-/10-/8-Bit I2C VOUT DACs with 10ppm/°C Reference
7
8 @verbatim
9 NOTES
10 Setup:
11 Set the terminal baud rate to 115200 and select the newline terminator.
12 The program displays calculated voltages which are based on the voltage
13 of the reference used, be it internal or external. A precision voltmeter
14 is needed to verify the actual measured voltages against the calculated
15 voltage displayed. If an external reference is used, a precision voltage
16 source is required to apply the external reference voltage. A
17 precision voltmeter is also required to measure the external reference
18 voltage. No external power supply is required. Any assembly option may
19 be used: DC1534A-A, DC1534A-B, DC1534A-C, DC1534A-D.
20
21
22 Explanation of Commands:
23 1- Select DAC: Select one of eight DACs to test : A, B, C, D, E, F, G, H.
24
25 2- Write to DAC input register: Value is stored in the DAC for updating
26 later, allowing multiple channels to be updated at once, either
27 through a software "Update All" command or by asserting the LDAC# pin.
28 User will be prompted to enter either a code in hex or decimal, or a
29 voltage. If a voltage is entered, a code will be calculated based on
30 the active scaling and reference parameters - ideal values if no
31 calibration was ever stored.
32
33 3- Write and Update: Similar to item 1, but DAC is updated immediately.
34
35 4- Update DAC: Copies the value from the input register into the DAC
36 Register. Note that a "write and update" command writes the code to
37 BOTH the input register and DAC register, so subsequent "update"
38 commands will simply re-copy the same data (no change in output.)
39
40 5- Power Down DAC: Disable DAC output. Power supply current is reduced.
41 DAC code present in DAC registers at time of shutdown are preserved.
42
43 6- Set reference mode, either internal or external: Selecting external
44 mode prompts for the external reference voltage, which is used directly
45 if no individual DAC calibration is stored. The selection and entered
46 voltage are stored to EEPROM so it is persistent across reset / power cycles.
47
48 7- Calibrate DAC: Use a precision voltmeter to obtain and enter VOUT
49 readings taken with different DAC codes. Set reference mode FIRST,
50 as values are stored separately for internal and external reference
51 mode. Entries are used to calculate the closest code to send to the
52 DAC to achieve an entered voltage.
53
54 8- Enable / Disable calibration: Switch between stored calibration
55 values and defaults. Calibration parameters are stored separately
56 for internal and external reference modes. Ideal calibration will
57 be used if the calibration parameter valid key is not set.
58
59
60 USER INPUT DATA FORMAT:
61 decimal : 1024
62 hex : 0x400
63 octal : 02000 (leading 0 "zero")
64 binary : B10000000000
65 float : 1024.0
66
67 @endverbatim
68
69 http://www.linear.com/product/LTC2637
70 http://www.linear.com/product/LTC2635
71
72 http://www.linear.com/product/LTC2637#demoboards
73 http://www.linear.com/product/LTC2635#demoboards
74
75
76 Copyright 2018(c) Analog Devices, Inc.
77
78 All rights reserved.
79
80 Redistribution and use in source and binary forms, with or without
81 modification, are permitted provided that the following conditions are met:
82 - Redistributions of source code must retain the above copyright
83 notice, this list of conditions and the following disclaimer.
84 - Redistributions in binary form must reproduce the above copyright
85 notice, this list of conditions and the following disclaimer in
86 the documentation and/or other materials provided with the
87 distribution.
88 - Neither the name of Analog Devices, Inc. nor the names of its
89 contributors may be used to endorse or promote products derived
90 from this software without specific prior written permission.
91 - The use of this software may or may not infringe the patent rights
92 of one or more patent holders. This license does not release you
93 from the requirement that you obtain separate licenses from these
94 patent holders to use this software.
95 - Use of the software either in source or binary form, must be run
96 on or directly connected to an Analog Devices Inc. component.
97
98 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
99 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
100 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
101 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
102 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
103 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
104 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
105 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
106 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
107 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108 */
109
110 /*! @file
111 @ingroup LTC2637
112 */
113
114 #include <Arduino.h>
115 #include <stdint.h>
116 #include "Linduino.h"
117 #include "LT_SPI.h"
118 #include "UserInterface.h"
119 #include "LT_I2C.h"
120 #include "QuikEval_EEPROM.h"
121 #include "LTC2637.h"
122 #include <SPI.h>
123 #include <Wire.h>
124
125 #define EEPROM_CAL_KEY_INT 0x5678 //!< Calibration associated with internal reference
126 #define EEPROM_CAL_KEY_EXT 0x9ABC //!< Calibration associated with external reference
127
128 // DAC Reference State
129 // Could have been zero or 1, this allows you to use the
130 // variable "reference_mode" as the command argument to a write
131 #define REF_INTERNAL LTC2637_CMD_INTERNAL_REFERENCE //!< Stored reference state is Internal
132 #define REF_EXTERNAL LTC2637_CMD_EXTERNAL_REFERENCE //!< Stored reference state is External
133
134 // EEPROM memory locations
135 #define STORED_REF_STATE_BASE EEPROM_CAL_STATUS_ADDRESS //!< Base address of the stored reference state
136 #define INT_CAL_VALID_BASE STORED_REF_STATE_BASE + 2 //!< Base address of the "internal ref calibration valid" flag
137 #define INT_CAL_PARAMS_BASE INT_CAL_VALID_BASE + 2 //!< Base address of the internal ref calibration parameters
138 #define EXT_CAL_VALID_BASE INT_CAL_PARAMS_BASE + 32 //!< Base address of the "external ref calibration valid" flag
139 #define EXT_CAL_PARAMS_BASE EXT_CAL_VALID_BASE + 2 //!< Base address of the external ref calibration parameters
140 #define EXT_REF_V_BASE EXT_CAL_PARAMS_BASE + 32 //!< Base address of the stored external reference voltage
141
142 // Function Declaration
143 int8_t restore_calibration(); // Read the DAC calibration from EEPROM, Return 1 if successful, 0 if not
144 void print_title(); // Print the title block
145 void print_prompt(int16_t selected_dac); // Prompt the user for an input command
146 int16_t prompt_voltage_or_code();
147 uint16_t get_voltage(float LTC2637_lsb, int16_t LTC2637_offset);
148 uint16_t get_code();
149 int8_t calibrate_dac(uint8_t index); // Calibrate the selected DAC using a voltmeter. The routine does a linear curve fit given two data points.
150
151 int8_t menu_1_select_dac(int16_t *selected_dac);
152 int8_t menu_2_write_to_input_register(int16_t selected_dac);
153 int8_t menu_3_write_and_update_dac(int16_t selected_dac);
154 int8_t menu_4_update_power_up_dac(int16_t selected_dac);
155 int8_t menu_5_power_down_dac(int16_t selected_dac);
156 int8_t menu_6_set_reference_mode(); // int, ext, if ext, prompt for voltage
157 int8_t menu_7_calibrate_dacs();
158
159 // Global variables
160 static uint8_t demo_board_connected; //!< Set to 1 if the board is connected
161 static uint8_t shift_count; //!< The data align shift count. For 16-bit=0, for 12-bits=4
162 static uint8_t reference_mode; //!< Tells whether to set internal or external reference
163
164 // Global calibration variables
165 static float reference_voltage; //!< Reference voltage, either internal or external
166 static int16_t LTC2637_offset[9]; //!< DAC offset - index 8 for "all DACs"
167 static float LTC2637_lsb[9]; //!< The LTC2637 lsb - index 8 for "all DACs"
168 static uint8_t num_of_channels = 8; // Change to 4 for LTC2635.
169
170 // Constants
171
172 //! Lookup table for DAC address. Allows the "All DACs" address to be indexed right after DAC D in loops.
173 //! This technique is very useful for devices with non-monotonic channel addresses.
174 const uint8_t address_map[9] = {LTC2637_DAC_A, LTC2637_DAC_B, LTC2637_DAC_C, LTC2637_DAC_D, LTC2637_DAC_E, LTC2637_DAC_F, LTC2637_DAC_G, LTC2637_DAC_H, LTC2637_DAC_ALL}; //!< Map entered option 0..2 to DAC address
175
176 //! Used to keep track to print voltage or print code
177 enum
178 {
179 PROMPT_VOLTAGE = 0, /**< 0 */
180 PROMPT_CODE = 1 /**< 1 */
181 };
182
183 //! Initialize Linduino
184 void setup()
185 // Setup the program
186 {
187 char demo_name[] = "DC1534"; // Demo Board Name stored in QuikEval EEPROM
188
189 quikeval_I2C_init(); // Configure the EEPROM I2C port for 100kHz
190 quikeval_I2C_connect(); // Connect I2C to main data port
191 Serial.begin(115200); // Initialize the serial port to the PC
192 print_title();
193 demo_board_connected = discover_demo_board(demo_name);
194 if (demo_board_connected)
195 {
196 restore_calibration();
197 print_prompt(0);
198 }
199 }
200
201 //! Repeats Linduino loop
202 void loop()
203 {
204 int8_t ack=0;
205 int16_t user_command;
206 static int16_t selected_dac = 0; // The selected DAC to be updated (0=A, 1=B ... 8=All). Initialized to "A".
207 // The main control loop
208 if (demo_board_connected) // Do nothing if the demo board is not connected
209 {
210 if (Serial.available()) // Check for user input
211 {
212 user_command = read_int(); // Read the user command
213 Serial.println(user_command);
214 Serial.flush();
215 ack = 0;
216 switch (user_command)
217 {
218 case 1:
219 ack |= menu_1_select_dac(&selected_dac);
220 break;
221 case 2:
222 ack |= menu_2_write_to_input_register(selected_dac);
223 break;
224 case 3:
225 ack |= menu_3_write_and_update_dac(selected_dac);
226 break;
227 case 4:
228 ack |= menu_4_update_power_up_dac(selected_dac);
229 break;
230 case 5:
231 ack |= menu_5_power_down_dac(selected_dac);
232 break;
233 case 6:
234 ack |= menu_6_set_reference_mode(); // int, ext, if ext, prompt for voltage
235 break;
236 case 7:
237 ack |= menu_7_calibrate_dacs();
238 restore_calibration();
239 break;
240 default:
241 Serial.println("Incorrect Option");
242 break;
243 }
244 if (ack) Serial.println("I2C NACK received, check address\n");
245 Serial.println("\n*****************************************************************");
246 print_prompt(selected_dac);
247 }
248 }
249 }
250
251 // Function Definitions
252
253 //! Select which DAC to operate on
254 //! @return 0
255 int8_t menu_1_select_dac(int16_t *selected_dac)
256 {
257 // Select a DAC to operate on
258 Serial.print("Select DAC to operate on (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=All): ");
259 *selected_dac = read_int();
260 if (*selected_dac != num_of_channels)
261 Serial.println((char) (*selected_dac + 0x41));
262 else
263 Serial.println(F("All"));
264 return 0;
265 }
266
267 //! Write data to input register, but do not update DAC output
268 //! @return ACK bit (0=acknowledge, 1=no acknowledge)
269 int8_t menu_2_write_to_input_register(int16_t selected_dac)
270 {
271 int8_t ack=0;
272 uint16_t dac_code;
273
274 if (prompt_voltage_or_code() == PROMPT_VOLTAGE)
275 dac_code = get_voltage(LTC2637_lsb[selected_dac], LTC2637_offset[selected_dac]);
276 else
277 dac_code = get_code();
278
279 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, LTC2637_CMD_WRITE, address_map[selected_dac], dac_code << shift_count);
280 return (ack);
281 }
282
283 //!Write data to DAC register (which updates output immediately)
284 //! @return ACK bit (0=acknowledge, 1=no acknowledge)
285 int8_t menu_3_write_and_update_dac(int16_t selected_dac)
286 {
287 int8_t ack=0;
288 uint16_t dac_code;
289
290 if (prompt_voltage_or_code() == PROMPT_VOLTAGE)
291 dac_code = get_voltage(LTC2637_lsb[selected_dac], LTC2637_offset[selected_dac]);
292 else
293 dac_code = get_code();
294
295 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, LTC2637_CMD_WRITE_UPDATE, address_map[selected_dac], dac_code << shift_count);
296 return (ack);
297 }
298
299 //! Update DAC with data that is stored in input register, power up if sleeping
300 //! @return ACK bit (0=acknowledge, 1=no acknowledge)
301 int8_t menu_4_update_power_up_dac(int16_t selected_dac)
302 {
303 // Update DAC
304 int8_t ack=0;
305 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, LTC2637_CMD_UPDATE, address_map[selected_dac], 0x0000);
306 Serial.print("DAC ");
307 if (selected_dac != num_of_channels)
308 Serial.print((char) (selected_dac + 0x41));
309 else
310 Serial.print("All");
311 Serial.println(" powered up!");
312 return (ack);
313 }
314
315 //! Power down DAC
316 //! @return ACK bit (0=acknowledge, 1=no acknowledge)
317 int8_t menu_5_power_down_dac(int16_t selected_dac)
318 {
319 // Power down DAC
320 int8_t ack=0;
321 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, LTC2637_CMD_POWER_DOWN, address_map[selected_dac], 0x0000);
322 Serial.print("DAC ");
323 if (selected_dac != num_of_channels)
324 Serial.print((char) (selected_dac + 0x41));
325 else
326 Serial.print("All");
327 Serial.println(" powered down!");
328 return (ack);
329 }
330
331 //! Set reference mode and store to EEPROM
332 //! @return 0
333 int8_t menu_6_set_reference_mode(void) // int, ext, if ext, prompt for voltage
334 {
335 int16_t user_input;
336 Serial.println("Select reference mode - 0 for Internal, 1 for External");
337 user_input = read_int();
338 if (user_input == 1)
339 {
340 reference_mode = REF_EXTERNAL;
341 Serial.println(F("External reference mode selected"));
342 }
343 else
344 {
345 reference_mode = REF_INTERNAL;
346 Serial.println(F("Internal reference mode selected"));
347 }
348 restore_calibration();
349 }
350
351 //! Calibrate all DACs by measuring two known outputs
352 //! @return 0
353 int8_t menu_7_calibrate_dacs()
354 {
355 // Calibrate the DACs using a multi-meter
356 uint8_t i;
357 for (i = 0; i < num_of_channels; i++)
358 {
359 calibrate_dac(i); // Run calibration routine
360 }
361 return (0);
362 }
363
364
365 //! Read stored calibration parameters from nonvolatile EEPROM on demo board
366 //! @return Return 1 if successful, 0 if not
367 int8_t restore_calibration()
368 // Read the DAC calibration from EEPROM
369 // Return 1 if successful, 0 if not
370 {
371 int8_t ack=0;
372 uint8_t i;
373 float dac_count; // The number of codes, 4096 for 12 bits, 65536 for 16 bits
374
375 if (reference_mode == REF_EXTERNAL)
376 {
377 Serial.println(F("External reference mode set"));
378 Serial.print("Enter external reference voltage: ");
379 reference_voltage = read_float();
380 Serial.print(reference_voltage, 3);
381 Serial.println("V");
382 }
383 else // EITHER reference is set to internal, OR not programmed in which case default to internal
384 {
385 reference_mode = REF_INTERNAL; // Redundant if already set
386 Serial.println("Internal reference mode set");
387 }
388
389 // Write the reference mode to the DAC right away
390 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, reference_mode, LTC2637_DAC_ALL, 0x0000);
391
392 // The following two IF statements are used to allow the program to run with
393 // a QuikEval string that does not contain the demo board option.
394 // If the demo board option is found then these values are overwritten.
395 if (strcmp(demo_board.product_name, "LTC2637-LMI") == 0)
396 {
397 // LTC2636-LM, 12-bits, 2.5V full scale
398 shift_count = 4;
399 if (reference_mode == REF_INTERNAL)
400 {
401 reference_voltage = 2.5;
402 Serial.println("Internal reference voltage = 2.5 V");
403 }
404 dac_count = 4096;
405 }
406 if (strcmp(demo_board.product_name, "LTC2637-HZ") == 0)
407 {
408 // LTC2636-HZ, 12-bits, 4.096V full scale
409 shift_count = 4;
410 if (reference_mode == REF_INTERNAL)
411 {
412 reference_voltage = 4.096;
413 Serial.println("Internal reference voltage = 4.096 V");
414 }
415 dac_count = 4096;
416 }
417 if (strcmp(demo_board.product_name, "LTC2637-HMI") == 0)
418 {
419 // LTC2636-HM, 12-bits, 4.096V full scale
420 shift_count = 4;
421 if (reference_mode == REF_INTERNAL)
422 {
423 reference_voltage = 4.096;
424 Serial.println("Internal reference voltage = 4.096 V");
425 }
426 dac_count = 4096;
427 }
428 if (strcmp(demo_board.product_name, "LTC2637-LZ") == 0)
429 {
430 // LTC2636-LZ, 12-bits, 4.096V full scale
431 shift_count = 4;
432 if (reference_mode == REF_INTERNAL)
433 {
434 reference_voltage = 2.5;
435 Serial.println("Internal reference voltage = 2.5 V");
436 }
437 dac_count = 4096;
438 }
439
440 for (i = 0; i <= num_of_channels; i++)
441 {
442 LTC2637_offset[i] = 0;
443 LTC2637_lsb[i] = reference_voltage / dac_count;
444 }
445 for (i=0; i<=num_of_channels; ++i)
446 {
447 Serial.print("DAC ");
448 Serial.print((char) ('A' + i));
449 Serial.print(" offset: ");
450 Serial.print(LTC2637_offset[i]);
451 Serial.print(" , lsb: ");
452 Serial.print(LTC2637_lsb[i]*1000, 4);
453 Serial.println(" mv");
454 }
455 return ack;
456 }
457
458 //! Prompt user to enter a voltage or digital code to send to DAC
459 //! @return prompt type
460 int16_t prompt_voltage_or_code()
461 {
462 int16_t user_input;
463 Serial.print(F("Type 1 to enter voltage, 2 to enter code:"));
464 Serial.flush();
465 user_input = read_int();
466 Serial.println(user_input);
467
468 if (user_input != 2)
469 return(PROMPT_VOLTAGE);
470 else
471 return(PROMPT_CODE);
472 }
473
474 //! Get voltage from user input, calculate DAC code based on lsb, offset
475 //! @return Returns DAC voltage
476 uint16_t get_voltage(float LTC2637_lsb, int16_t LTC2637_offset)
477 {
478 float dac_voltage;
479
480 Serial.print(F("Enter Desired DAC output voltage: "));
481 dac_voltage = read_float();
482 Serial.print(dac_voltage);
483 Serial.println(" V");
484 Serial.flush();
485 return(LTC2637_voltage_to_code(dac_voltage, LTC2637_lsb, LTC2637_offset));
486 }
487
488 //! Get code to send to DAC directly, in decimal, hex, or binary
489 //! @return Returns DAC code from user
490 uint16_t get_code()
491 {
492 uint16_t returncode;
493 Serial.println("Enter Desired DAC Code");
494 Serial.print("(Format 32768, 0x8000, 0100000, or B1000000000000000): ");
495 returncode = (uint16_t) read_int();
496 Serial.print("0x");
497 Serial.println(returncode, HEX);
498 Serial.flush();
499 return(returncode);
500 }
501
502 //! Prints the title block when program first starts.
503 void print_title()
504 {
505 Serial.println("");
506 Serial.println(F("*****************************************************************"));
507 Serial.println(F("* DC1534 Demonstration Program *"));
508 Serial.println(F("* *"));
509 Serial.println(F("* This program demonstrates how to send data to the LTC2637 *"));
510 Serial.println(F("* Octal 12/10/8-bit DAC found on the DC1534 demo board. *"));
511 Serial.println(F("* *"));
512 Serial.println(F("* Set the baud rate to 115200 and select the newline terminator.*"));
513 Serial.println(F("* *"));
514 Serial.println(F("*****************************************************************"));
515 }
516
517 //! Prints main menu.
518 void print_prompt(int16_t selected_dac)
519 {
520 Serial.println(F("\nCommand Summary:"));
521 Serial.println(F(" 1-Select DAC"));
522 Serial.println(F(" 2-Write to input register (no update)"));
523 Serial.println(F(" 3-Write and update DAC"));
524 Serial.println(F(" 4-Update / power up DAC"));
525 Serial.println(F(" 5-Power down DAC"));
526 Serial.println(F(" 6-Set reference mode"));
527 Serial.println(F(" 7-Calibrate DAC"));
528
529 Serial.println("\nPresent Values:");
530 Serial.print(" Selected DAC: ");
531 if (selected_dac != 8)
532 Serial.println((char) (selected_dac + 0x41));
533 else
534 Serial.println("All");
535 Serial.print(" DAC Reference: ");
536 if (reference_mode == REF_INTERNAL)
537 Serial.println("Internal");
538 else
539 {
540 Serial.print(F("External "));
541 Serial.print(reference_voltage, 5);
542 Serial.println(F("V reference, please verify"));
543 }
544 Serial.print(F("Enter a command:"));
545 Serial.flush();
546 }
547
548 //! Calibrate the selected DAC using a voltmeter. The routine
549 //! does a linear curve fit given two data points.
550 //! @return ACK bit (0=acknowledge, 1=no acknowledge)
551 int8_t calibrate_dac(uint8_t index)
552 {
553 int8_t ack=0;
554 uint16_t code1 = 0x0200; //! Calibration code 1
555 uint16_t code2 = 0x0FFF; //! Calibration code 2
556 float voltage1; //! Calibration voltage 1
557 float voltage2; //! Calibration voltage 2
558 Serial.println("");
559 Serial.print("Calibrating DAC ");
560 Serial.println((char) (0x41 + index));
561 // Left align 12-bit code1 to 16 bits & write to DAC
562 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, LTC2637_CMD_WRITE_UPDATE, index, code1 << shift_count);
563 Serial.print("DAC code set to 0x");
564 Serial.println(code1, HEX);
565 Serial.print("Enter measured DAC voltage:");
566 voltage1 = read_float();
567 Serial.print(voltage1, 6);
568 Serial.println(" V");
569 // Left align 12-bit code2 to 16 bits & write to DAC
570 ack |= LTC2637_write(LTC2637_I2C_ADDRESS, LTC2637_CMD_WRITE_UPDATE, index, code2 << shift_count);
571 Serial.print("DAC code set to 0x");
572 Serial.println(code2, HEX);
573 Serial.print("Enter measured DAC voltage:");
574 voltage2 = read_float();
575 Serial.print(voltage2, 6);
576 Serial.println(" V");
577 LTC2637_calibrate(code1, code2, voltage1, voltage2, &LTC2637_lsb[index], &LTC2637_offset[index]);
578 return(ack);
579 }
demo_board
struct demo_board_type demo_board
Instantiate demo board structure.
Definition: QuikEval_EEPROM.cpp:71
LTC2637_offset
static int16_t LTC2637_offset[9]
DAC offset - index 8 for "all DACs".
Definition: DC1534A.ino:166
LTC2637_lsb
static float LTC2637_lsb[9]
The LTC2637 lsb - index 8 for "all DACs".
Definition: DC1534A.ino:167
calibrate_dac
static int8_t calibrate_dac(uint8_t index)
Calibrate the selected DAC using a voltmeter.
Definition: DC1534A.ino:551
user_command
unsigned char user_command
Definition: Serial_EEPROM_Test.ino:75
LTC2637.h
LTC2637: Octal 12-/10-/8-Bit I2C VOUT DACs with 10ppm/°C Reference.
menu_3_write_and_update_dac
static int8_t menu_3_write_and_update_dac(int16_t selected_dac)
Write data to DAC register (which updates output immediately)
Definition: DC1534A.ino:285
LTC2637_calibrate
void LTC2637_calibrate(uint16_t dac_code1, uint16_t dac_code2, float voltage1, float voltage2, float *LTC2637_lsb, int16_t *LTC2637_offset)
Calculate the LTC2637 offset and LSB voltages given two measured voltages and their corresponding cod...
Definition: LTC2637.cpp:117
demo_board_connected
static uint8_t demo_board_connected
Set to 1 if the board is connected.
Definition: DC1534A.ino:160
address_map
const uint8_t address_map[9]
Lookup table for DAC address.
Definition: DC1534A.ino:174
Linduino.h
Header File for Linduino Libraries and Demo Code.
get_voltage
static uint16_t get_voltage(float LTC2637_lsb, int16_t LTC2637_offset)
Get voltage from user input, calculate DAC code based on lsb, offset.
Definition: DC1534A.ino:476
print_title
static void print_title()
Prints the title block when program first starts.
Definition: DC1534A.ino:503
prompt_voltage_or_code
static int16_t prompt_voltage_or_code()
Prompt user to enter a voltage or digital code to send to DAC.
Definition: DC1534A.ino:460
LTC2637_DAC_C
#define LTC2637_DAC_C
Definition: LTC2637.h:167
REF_INTERNAL
#define REF_INTERNAL
Stored reference state is Internal.
Definition: DC1534A.ino:131
menu_2_write_to_input_register
static int8_t menu_2_write_to_input_register(int16_t selected_dac)
Write data to input register, but do not update DAC output.
Definition: DC1534A.ino:269
shift_count
static uint8_t shift_count
The data align shift count.
Definition: DC1534A.ino:161
LTC2637_CMD_UPDATE
#define LTC2637_CMD_UPDATE
Definition: LTC2637.h:153
menu_7_calibrate_dacs
static int8_t menu_7_calibrate_dacs()
Calibrate all DACs by measuring two known outputs.
Definition: DC1534A.ino:353
reference_mode
static uint8_t reference_mode
Tells whether to set internal or external reference.
Definition: DC1534A.ino:162
menu_4_update_power_up_dac
static int8_t menu_4_update_power_up_dac(int16_t selected_dac)
Update DAC with data that is stored in input register, power up if sleeping.
Definition: DC1534A.ino:301
LTC2637_write
int8_t LTC2637_write(uint8_t i2c_address, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write a 16-bit dac_code to the LTC2637.
Definition: LTC2637.cpp:87
LTC2637_CMD_WRITE
#define LTC2637_CMD_WRITE
Definition: LTC2637.h:152
reference_voltage
static float reference_voltage
Reference voltage, either internal or external.
Definition: DC1534A.ino:165
num_of_channels
static uint8_t num_of_channels
Definition: DC1534A.ino:168
QuikEval_EEPROM.h
QuikEval EEPROM Library.
restore_calibration
static int8_t restore_calibration()
Read stored calibration parameters from nonvolatile EEPROM on demo board.
Definition: DC1534A.ino:367
LTC2637_voltage_to_code
uint16_t LTC2637_voltage_to_code(float dac_voltage, float LTC2637_lsb, int16_t LTC2637_offset)
Calculate a LTC2637 DAC code given the desired output voltage and DAC address (0-3) ...
Definition: LTC2637.cpp:96
menu_6_set_reference_mode
static int8_t menu_6_set_reference_mode()
Set reference mode and store to EEPROM.
Definition: DC1534A.ino:333
discover_demo_board
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
Definition: QuikEval_EEPROM.cpp:141
loop
static void loop()
Repeats Linduino loop.
Definition: DC1534A.ino:202
PROMPT_VOLTAGE
0
Definition: DC1534A.ino:179
menu_5_power_down_dac
static int8_t menu_5_power_down_dac(int16_t selected_dac)
Power down DAC.
Definition: DC1534A.ino:317
LTC2637_CMD_WRITE_UPDATE
#define LTC2637_CMD_WRITE_UPDATE
Definition: LTC2637.h:154
LT_SPI.h
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
LTC2637_DAC_ALL
#define LTC2637_DAC_ALL
Definition: LTC2637.h:173
LTC2637_DAC_A
#define LTC2637_DAC_A
Definition: LTC2637.h:165
LTC2637_DAC_H
#define LTC2637_DAC_H
Definition: LTC2637.h:172
LTC2637_DAC_B
#define LTC2637_DAC_B
Definition: LTC2637.h:166
LT_I2C.h
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
get_code
static uint16_t get_code()
Get code to send to DAC directly, in decimal, hex, or binary.
Definition: DC1534A.ino:490
LTC2637_DAC_D
#define LTC2637_DAC_D
Definition: LTC2637.h:168
demo_name
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
UserInterface.h
setup
static void setup()
Initialize Linduino.
Definition: DC1534A.ino:184
read_int
int32_t read_int()
Definition: UserInterface.cpp:93
index
static int index
Definition: device_logger.ino:91
LTC2637_DAC_F
#define LTC2637_DAC_F
Definition: LTC2637.h:170
read_float
float read_float()
Definition: UserInterface.cpp:78
demo_board_type::product_name
char product_name[15]
LTC Product (LTC2654-L16)
Definition: QuikEval_EEPROM.h:70
LTC2637_CMD_POWER_DOWN
#define LTC2637_CMD_POWER_DOWN
Definition: LTC2637.h:155
quikeval_I2C_init
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
Definition: LT_I2C.cpp:394
quikeval_I2C_connect
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
Definition: LT_I2C.cpp:401
i
static int i
Definition: DC2430A.ino:184
LTC2637_DAC_G
#define LTC2637_DAC_G
Definition: LTC2637.h:171
LTC2637_DAC_E
#define LTC2637_DAC_E
Definition: LTC2637.h:169
print_prompt
static void print_prompt(int16_t selected_dac)
Prints main menu.
Definition: DC1534A.ino:518
REF_EXTERNAL
#define REF_EXTERNAL
Stored reference state is External.
Definition: DC1534A.ino:132
PROMPT_CODE
1
Definition: DC1534A.ino:180
menu_1_select_dac
static int8_t menu_1_select_dac(int16_t *selected_dac)
Select which DAC to operate on.
Definition: DC1534A.ino:255
LTC2637_I2C_ADDRESS
#define LTC2637_I2C_ADDRESS
Definition: LTC2637.h:118