118 Serial.begin(115200);
128 Serial.println(
"Connected...");
137 if (Serial.available())
140 Serial.println(user_command);
142 switch (user_command)
154 Serial.println(F(
"Incorrect Option"));
157 Serial.println(F(
"\n************************************************************"));
166 Serial.println(F(
"*****************************************************************"));
167 Serial.println(F(
"* DC572A Demonstration Program *"));
168 Serial.println(F(
"* *"));
169 Serial.println(F(
"* This program demonstrates how to send data to the LTC1592 *"));
170 Serial.println(F(
"* 16-bit SoftSpan DAC found on the DC572A demo board. *"));
171 Serial.println(F(
"* *"));
172 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
173 Serial.println(F(
"* *"));
174 Serial.println(F(
"*****************************************************************\n"));
180 Serial.println(F(
"\nCommand Summary:"));
181 Serial.println(F(
" 1-Voltage Output"));
182 Serial.println(F(
" 2-Square wave output"));
183 Serial.println(F(
" 3-Change Range"));
185 Serial.println(F(
"\nPresent Values:"));
186 Serial.print(F(
" Range: "));
190 Serial.print(F(
"0V to 5V"));
194 Serial.print(F(
"0V to 10V"));
198 Serial.print(F(
"-5V to +5V"));
202 Serial.print(F(
"-10V to +10V"));
206 Serial.print(F(
"-2.5V to +2.5V"));
210 Serial.print(F(
"-2.5V to 7.5V"));
214 Serial.println(
"0V to 5V");
217 Serial.print(F(
"\n\nEnter a command: "));
226 Serial.print(
"\nEnter the 16-bit data as decimal or hex: ");
229 Serial.println(
data, HEX);
261 Serial.print(
"\nOutput voltage = ");
262 Serial.print(voltage);
263 Serial.println(
" V");
272 float voltage_high, voltage_low;
273 uint16_t data_voltage_high, data_voltage_low;
274 uint8_t receive_enter;
277 Serial.print(
"\nEnter voltage_high: ");
278 while (!Serial.available());
280 Serial.print(voltage_high);
281 Serial.println(
" V");
284 Serial.print(
"\nEnter voltage_low: ");
285 while (!Serial.available());
287 Serial.print(voltage_low);
288 Serial.println(
" V");
291 Serial.print(
"\nEnter the required frequency in Hz: ");
294 Serial.println(
" Hz");
296 time = (float)1000/freq;
297 Serial.print(
"\nT = ");
299 Serial.println(
" ms");
332 while (!Serial.available())
335 delayMicroseconds(time * 500);
337 delayMicroseconds(time * 500);
346 Serial.println(
"\n| Choice | Range |");
347 Serial.println(
"|--------|---------------|");
348 Serial.println(
"| 0 | 0 - 5 V |");
349 Serial.println(
"| 1 | 0 - 10 V |");
350 Serial.println(
"| 2 | -5 - +5 V |");
351 Serial.println(
"| 3 | -10 - +10 V |");
352 Serial.println(
"| 4 | -2.5 - +2.5 V |");
353 Serial.println(
"| 5 | -2.5 - 7.5 V |");
355 Serial.print(
"\nEnter your choice: ");
392 Serial.println(
"\nWrong choice!");
static uint8_t demo_board_connected
Set to 1 if the board is connected.
unsigned char user_command
#define LTC1592_RANGE_MINUS_2_5V_TO_PLUS_7_5V
static void menu_3_change_range()
Function to choose the range of voltages to be used.
static void print_title()
Prints the title block when program first starts.
float LTC1592_code_to_voltage(uint16_t data, float RANGE_HIGH, float RANGE_LOW)
Calculates the voltage from ADC output data depending on the channel configuration.
#define LTC1592_RANGE_0_TO_10V
LTC1592: 16-bit SoftSpan DAC with Programmable Output Range.
Header File for Linduino Libraries and Demo Code.
static float LTC1592_RANGE_LOW
#define LTC1592_CS
Headerfiles.
#define LTC1592_RANGE_PLUS_MINUS_5V
#define LTC1592_RANGE_0_TO_5V
static void loop()
Repeats Linduino loop.
void LTC1592_write(uint8_t cs, uint8_t dac_command, uint16_t data)
Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data.
static uint8_t range_selected
#define LTC1592_RANGE_PLUS_MINUS_10V
#define LTC1592_RANGE_PLUS_MINUS_2_5V
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
static float LTC1592_RANGE_HIGH
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void setup()
Initialize Linduino.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
static uint8_t menu_2_square_wave_output()
Function to generate a square wave of desired frequency and voltage ranges.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
uint16_t LTC1592_voltage_to_code(float voltage, float RANGE_HIGH, float RANGE_LOW)
Calculates the 16 bit data code from voltage.
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]
static uint8_t menu_1_voltage_output()
Function to enter a digital value and get the analog output.
static void print_prompt()
Prints main menu.