113 Serial.begin(115200);
117 Serial.println(buffer);
129 static int16_t selected_dac =0;
133 if (Serial.available())
136 Serial.println(user_command);
138 switch (user_command)
156 Serial.println(
"\n*****************************************************************");
168 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)");
170 if (*selected_dac == 8)
172 Serial.println(
"All");
177 Serial.println(*selected_dac);
227 Serial.print(F(
"Type 1 to enter voltage, 2 to enter code:"));
230 Serial.println(user_input);
245 Serial.print(F(
"Enter Desired DAC output voltage: "));
247 Serial.print(dac_voltage);
248 Serial.println(
" V");
258 Serial.println(
"Enter Desired DAC Code");
259 Serial.print(
"(Format 32768, 0x8000, 0100000, or B1000000000000000): ");
262 Serial.println(returncode, HEX);
271 Serial.println(F(
"*****************************************************************"));
272 Serial.println(F(
"* DC579A Demonstration Program *"));
273 Serial.println(F(
"* *"));
274 Serial.println(F(
"* This program demonstrates how to send data to the LTC2600 *"));
275 Serial.println(F(
"* octal 16/14/12-bit DAC found on the DC579A demo board. *"));
276 Serial.println(F(
"* *"));
277 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
278 Serial.println(F(
"* *"));
279 Serial.println(F(
"*****************************************************************"));
285 Serial.println(F(
"\nCommand Summary:"));
286 Serial.println(F(
" 1-Select DAC"));
287 Serial.println(F(
" 2-Write to input register (no update)"));
288 Serial.println(F(
" 3-Write and update DAC"));
289 Serial.println(F(
" 4-Update / power up DAC"));
290 Serial.println(F(
" 5-Power down DAC"));
292 Serial.println(
"\nPresent Values:");
293 Serial.print(
" Selected DAC: ");
294 if (selected_dac != 4)
295 Serial.println((
char) (selected_dac + 0x41));
297 Serial.println(
"All");
298 Serial.print(
" DAC Reference: ");
299 Serial.println(
"Internal");
300 Serial.print(F(
"Enter a command:"));
#define LTC2600_CMD_POWER_DOWN
Power down n.
#define LTC2600_CMD_UPDATE
Update (power up) DAC register n.
#define LTC2600_CMD_WRITE
Write to input register n.
unsigned char user_command
static void menu_2_write_to_input_register(int16_t selected_dac)
Write data to input register, but do not update DAC output.
#define LTC2600_CMD_WRITE_UPDATE
Write to input register n, update (power up) all.
static void print_prompt(int16_t selected_dac)
Prints main menu.
LTC2600: Octal 16-Bit Rail-to-Rail DACs in 16-Lead SSOP.
static int16_t LTC2600_offset
Header File for Linduino Libraries and Demo Code.
static void setup()
Initialize Linduino.
static void menu_5_power_down_dac(int16_t selected_dac)
Power down DAC.
uint16_t LTC2600_voltage_to_code(float dac_voltage, float LTC2600_lsb, int16_t LTC2600_offset)
Calculate a LTC2600 DAC code given the desired output voltage and DAC address (0-3) ...
static void menu_3_write_and_update_dac(int16_t selected_dac)
Write data to DAC register (which updates output immediately)
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
static uint8_t shift_count
The data align shift count for 16-bit =0 14-bit =2 12-bit =4.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void menu_4_update_power_up_dac(int16_t selected_dac)
Update DAC with data that is stored in input register, power up if sleeping.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
static void menu_1_select_dac(int16_t *selected_dac)
Select which DAC to operate on.
static uint16_t get_voltage(float LTC2600_lsb, int16_t LTC2600_offset)
Get voltage from user input, calculate DAC code based on lsb, offset.
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...
#define LTC2600_CS
Define the SPI CS pin.
static void print_title()
Prints the title block when program first starts.
void LTC2600_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write the 16-bit dac_code to the LTC2600.
static int16_t prompt_voltage_or_code()
Prompt user to enter a voltage or digital code to send to DAC.
static float reference_voltage
set based on jumper positions
static uint16_t get_code()
Get code to send to DAC directly, in decimal, hex, or binary.
static uint8_t demo_board_connected
set to 1 if the board is connected
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...
const uint8_t address_map[5]
Lookup table for DAC address.
static void loop()
Repeats Linduino loops.