119 char product_name[] =
"LTC2752";
120 char board_name[] =
"DC1684";
126 Serial.begin(115200);
140 Serial.print(F(
"\nChecking EEPROM contents..."));
147 Serial.print(
"\nDemo Board Name: ");
149 Serial.print(
"Product Name: ");
153 Serial.print(
"Demo Board Option: ");
156 Serial.println(F(
"Demo board connected..."));
157 Serial.println(F(
"\n\n\t\t\t\tPress Enter to Continue..."));
163 Serial.print(
"Demo board ");
164 Serial.print(board_name);
165 Serial.print(
" not found, \nfound ");
167 Serial.println(
" instead. \nConnect the correct demo board, then press the reset button.");
176 if (Serial.available())
179 Serial.println(user_command);
181 switch (user_command)
196 Serial.println(F(
"Incorrect Option"));
199 Serial.println(F(
"\n************************************************************"));
208 Serial.println(F(
"*****************************************************************"));
209 Serial.println(F(
"* DC1684A-B Demonstration Program *"));
210 Serial.println(F(
"* *"));
211 Serial.println(F(
"* This program demonstrates how to send data to the LTC2752 *"));
212 Serial.println(F(
"* Dual Serial 16-bit Soft Span DAC *"));
213 Serial.println(F(
"* *"));
214 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
215 Serial.println(F(
"* *"));
216 Serial.println(F(
"*****************************************************************\n"));
222 Serial.println(F(
"\nCommand Summary:"));
223 Serial.println(F(
"\n 1. Select DAC"));
224 Serial.println(F(
" 2. Change Span of selected DAC"));
225 Serial.println(F(
" 3. Voltage Output"));
226 Serial.println(F(
" 4. Square wave output"));
228 Serial.println(F(
"\nPresent Values:\n"));
229 Serial.print(F(
" DAC A Range: "));
231 Serial.print(F(
" V to "));
233 Serial.println(F(
" V"));
235 Serial.print(F(
" DAC B Range: "));
237 Serial.print(F(
" V to "));
239 Serial.println(F(
" V"));
241 Serial.print(F(
"\n Selected DAC: "));
245 Serial.println(F(
"DAC A"));
248 Serial.println(F(
"DAC B"));
251 Serial.println(F(
"ALL DACs"));
255 Serial.print(F(
"\n\nEnter a command: "));
263 Serial.println(F(
"\n1. DAC A"));
264 Serial.println(F(
"2. DAC B"));
265 Serial.println(F(
"3. All DACs"));
266 Serial.print(F(
"\nEnter a choice: "));
273 Serial.println(
"DAC A");
277 Serial.println(
"DAC B");
281 Serial.println(
"ALL DACs");
291 Serial.println(
"\n| Choice | Range |");
292 Serial.println(
"|--------|---------------|");
293 Serial.println(
"| 0 | 0 - 5 V |");
294 Serial.println(
"| 1 | 0 - 10 V |");
295 Serial.println(
"| 2 | -5 - +5 V |");
296 Serial.println(
"| 3 | -10 - +10 V |");
297 Serial.println(
"| 4 | -2.5 - +2.5 V |");
298 Serial.println(
"| 5 | -2.5 - +7.5 V |");
300 Serial.print(
"\nEnter your choice: ");
338 Serial.println(
"\nWrong choice!");
340 Serial.print(F(
"Span Changed!"));
377 Serial.println(
"\nWrong choice!");
379 Serial.print(F(
"Span Changed!"));
391 Serial.println(F(
"\n1. Enter Voltage"));
392 Serial.println(F(
"2. Enter Code"));
393 Serial.print(F(
"\nEnter a choice: "));
395 Serial.print(choice);
399 Serial.print(
"\nEnter the 16-bit data as decimal or hex: ");
402 Serial.println(data, HEX);
407 Serial.print(
"\nDACA Output voltage = ");
408 Serial.print(voltage);
409 Serial.println(
" V");
415 Serial.print(
"\nDACB Output voltage = ");
416 Serial.print(voltage);
417 Serial.println(
" V");
421 else if (choice == 1)
423 Serial.print(
"\nEnter voltage: ");
424 while (!Serial.available());
426 Serial.print(voltage);
427 Serial.println(
" V");
433 Serial.print(
"\nDACA Output voltage = ");
434 Serial.print(voltage);
435 Serial.println(
" V");
436 Serial.print(
"\nDAC CODE: 0x");
437 Serial.println(data, HEX);
444 Serial.print(
"\nDACB Output voltage = ");
445 Serial.print(voltage);
446 Serial.println(
" V");
447 Serial.print(
"\nDAC CODE: 0x");
448 Serial.println(data, HEX);
459 float voltage_high, voltage_low;
460 uint16_t code_high, code_low;
461 uint8_t receive_enter;
463 Serial.print(
"\nEnter voltage_high: ");
464 while (!Serial.available());
466 Serial.print(voltage_high);
467 Serial.println(
" V");
469 Serial.print(
"\nEnter voltage_low: ");
470 while (!Serial.available());
472 Serial.print(voltage_low);
473 Serial.println(
" V");
475 Serial.print(
"\nEnter the required frequency in Hz: ");
478 Serial.println(
" Hz");
480 time = (float)1000/freq;
481 Serial.print(
"\nT = ");
483 Serial.println(
" ms");
497 while (!Serial.available())
500 delayMicroseconds(time * 500);
502 delayMicroseconds(time * 500);
struct demo_board_type demo_board
Instantiate demo board structure.
char option
Demo Circuit option (A)
unsigned char user_command
static uint8_t menu1_select_dac()
Function to select DAC and set DAC address.
static uint8_t demo_board_connected
Set to 1 if the board is connected.
char name[15]
Demo Circuit number (DC1678)
#define LTC2752_CS
Define the SPI CS pin.
static uint8_t menu3_voltage_output()
Function to enter a digital value and get the analog output.
Header File for Linduino Libraries and Demo Code.
static void loop()
Repeats Linduino loop.
static uint8_t DAC_SELECTED
static float DACA_RANGE_HIGH
union LT_union_int32_4bytes data
static uint8_t discover_DC1684AB(char *product_name, char *board_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
#define LTC2752_WRITE_CODE_UPDATE_DAC
Write Code DAC n and Update DAC n.
void LTC2752_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t data)
Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data.
uint16_t LTC2752_voltage_to_code(float dac_voltage, float min_output, float max_output)
Calculate a LTC2752 DAC code given the desired output voltage and the minimum / maximum outputs for a...
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
static void menu2_change_range()
Function to choose the range of voltages to be used.
static float DACB_RANGE_HIGH
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void print_title()
Prints the title block when program first starts.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
char product_name[15]
LTC Product (LTC2654-L16)
static uint8_t menu4_square_wave_output()
Function to generate a square wave of desired frequency and voltage ranges.
static float DACB_RANGE_LOW
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
LTC2752: Dual Serial 16-Bit SoftSpan IOUT DAC.
static float DACA_RANGE_LOW
float LTC2752_code_to_voltage(uint16_t dac_code, float min_output, float max_output)
Calculate the LTC2752 DAC output voltage given the DAC code and and the minimum / maximum outputs for...
static void setup()
Initialize Linduino.
static void print_prompt()
Prints main menu.
uint8_t read_quikeval_id_string(char *buffer)
Read the id string from the EEPROM, then parse the product name, demo board name, and demo board opti...
char ui_buffer[UI_BUFFER_SIZE]
#define LTC2752_WRITE_SPAN_DAC
Write Span DAC n.