119 char product_name[] =
"LTC2758";
120 char board_name[] =
"DC1684";
126 Serial.begin(115200);
142 Serial.print(F(
"\nChecking EEPROM contents..."));
149 Serial.print(
"\nDemo Board Name: ");
151 Serial.print(
"Product Name: ");
155 Serial.print(
"Demo Board Option: ");
158 Serial.println(F(
"Demo board connected..."));
159 Serial.println(F(
"\n\n\t\t\t\tPress Enter to Continue..."));
165 Serial.print(
"Demo board ");
166 Serial.print(board_name);
167 Serial.print(
" not found, \nfound ");
169 Serial.println(
" instead. \nConnect the correct demo board, then press the reset button.");
178 if (Serial.available())
181 Serial.println(user_command);
183 switch (user_command)
198 Serial.println(F(
"Incorrect Option"));
201 Serial.println(F(
"\n************************************************************"));
210 Serial.println(F(
"*****************************************************************"));
211 Serial.println(F(
"* DC1684A-A Demonstration Program *"));
212 Serial.println(F(
"* *"));
213 Serial.println(F(
"* This program demonstrates how to send data to the LTC2758 *"));
214 Serial.println(F(
"* Dual Serial 18-bit Soft Span DAC *"));
215 Serial.println(F(
"* *"));
216 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
217 Serial.println(F(
"* *"));
218 Serial.println(F(
"*****************************************************************\n"));
224 Serial.println(F(
"\nCommand Summary:"));
225 Serial.println(F(
"\n 1. Select DAC"));
226 Serial.println(F(
" 2. Change Span of selected DAC"));
227 Serial.println(F(
" 3. Voltage Output"));
228 Serial.println(F(
" 4. Square wave output"));
230 Serial.println(F(
"\nPresent Values:\n"));
231 Serial.print(F(
" DAC A Range: "));
233 Serial.print(F(
" V to "));
235 Serial.println(F(
" V"));
237 Serial.print(F(
" DAC B Range: "));
239 Serial.print(F(
" V to "));
241 Serial.println(F(
" V"));
243 Serial.print(F(
"\n Selected DAC: "));
247 Serial.println(F(
"DAC A"));
250 Serial.println(F(
"DAC B"));
253 Serial.println(F(
"ALL DACs"));
257 Serial.print(F(
"\n\nEnter a command: "));
265 Serial.println(F(
"\n1. DAC A"));
266 Serial.println(F(
"2. DAC B"));
267 Serial.println(F(
"3. All DACs"));
268 Serial.print(F(
"\nEnter a choice: "));
275 Serial.println(
"DAC A");
279 Serial.println(
"DAC B");
283 Serial.println(
"ALL DACs");
294 Serial.println(
"\n| Choice | Range |");
295 Serial.println(
"|--------|---------------|");
296 Serial.println(
"| 0 | 0 - 5 V |");
297 Serial.println(
"| 1 | 0 - 10 V |");
298 Serial.println(
"| 2 | -5 - +5 V |");
299 Serial.println(
"| 3 | -10 - +10 V |");
300 Serial.println(
"| 4 | -2.5 - +2.5 V |");
301 Serial.println(
"| 5 | -2.5 - +7.5 V |");
303 Serial.print(
"\nEnter your choice: ");
305 Serial.println(choice);
306 span = (uint32_t)(choice << 2);
342 Serial.println(
"\nWrong choice!");
344 Serial.print(F(
"Span Changed!"));
381 Serial.println(
"\nWrong choice!");
383 Serial.print(F(
"Span Changed!"));
395 Serial.println(F(
"\n1. Enter Voltage"));
396 Serial.println(F(
"2. Enter Code"));
397 Serial.print(F(
"\nEnter a choice: "));
399 Serial.print(choice);
403 Serial.print(
"\nEnter the 18-bit data as decimal or hex: ");
406 Serial.println(data, HEX);
411 Serial.print(
"\nDACA Output voltage = ");
412 Serial.print(voltage);
413 Serial.println(
" V");
419 Serial.print(
"\nDACB Output voltage = ");
420 Serial.print(voltage);
421 Serial.println(
" V");
425 else if (choice == 1)
427 Serial.print(
"\nEnter voltage: ");
428 while (!Serial.available());
430 Serial.print(voltage);
431 Serial.println(
" V");
437 Serial.print(
"\nDACA Output voltage = ");
438 Serial.print(voltage);
439 Serial.println(
" V");
440 Serial.print(
"\nDAC CODE: 0x");
441 Serial.println(data, HEX);
449 Serial.print(
"\nDACB Output voltage = ");
450 Serial.print(voltage);
451 Serial.println(
" V");
452 Serial.print(
"\nDAC CODE: 0x");
453 Serial.println(data, HEX);
464 float voltage_high, voltage_low;
465 uint32_t code_high, code_low;
466 uint8_t receive_enter;
468 Serial.print(
"\nEnter voltage_high: ");
469 while (!Serial.available());
471 Serial.print(voltage_high);
472 Serial.println(
" V");
474 Serial.print(
"\nEnter voltage_low: ");
475 while (!Serial.available());
477 Serial.print(voltage_low);
478 Serial.println(
" V");
480 Serial.print(
"\nEnter the required frequency in Hz: ");
483 Serial.println(
" Hz");
485 time = (float)1000/freq;
486 Serial.print(
"\nT = ");
488 Serial.println(
" ms");
502 while (!Serial.available())
505 delayMicroseconds(time * 500);
507 delayMicroseconds(time * 500);
struct demo_board_type demo_board
Instantiate demo board structure.
static uint8_t menu1_select_dac()
Function to select DAC and set DAC address.
#define LTC2758_WRITE_CODE_UPDATE_DAC
Write Code DAC n and Update DAC n.
char option
Demo Circuit option (A)
unsigned char user_command
static uint8_t demo_board_connected
Set to 1 if the board is connected.
char name[15]
Demo Circuit number (DC1678)
void LTC2758_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint32_t data)
Transmits 32 bit input stream: 4-bit command + 4-bit don't-care + 18-bit data + 6 don't care...
static void loop()
Repeats Linduino loop.
Header File for Linduino Libraries and Demo Code.
static uint8_t menu3_voltage_output()
Function to enter a digital value and get the analog output.
#define LTC2758_CS
Define the SPI CS pin.
static float DACA_RANGE_HIGH
float LTC2758_code_to_voltage(uint32_t dac_code, float min_output, float max_output)
Calculate the LTC2758 DAC output voltage given the DAC code and and the minimum / maximum outputs for...
static uint8_t DAC_SELECTED
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 LTC2758_WRITE_SPAN_DAC
Write Span DAC n.
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.
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.
static float DACB_RANGE_HIGH
LTC2758: Dual Serial 18-Bit SoftSpan IOUT DAC.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
static float DACB_RANGE_LOW
char product_name[15]
LTC Product (LTC2654-L16)
static float DACA_RANGE_LOW
static uint8_t menu4_square_wave_output()
Function to generate a square wave of desired frequency and voltage ranges.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
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]
uint32_t LTC2758_voltage_to_code(float dac_voltage, float min_output, float max_output)
Calculate a LTC2758 DAC code given the desired output voltage and the minimum / maximum outputs for a...