104 #define REF_INTERNAL LTC2605_CMD_INTERNAL_REFERENCE 105 #define REF_EXTERNAL LTC2605_CMD_EXTERNAL_REFERENCE
150 Serial.begin(115200);
164 static int16_t selected_dac =0;
168 if (Serial.available())
171 Serial.println(user_command);
174 switch (user_command)
192 Serial.println(
"Incorrect Option");
195 if (ack)Serial.println(
"I2C NACK received, check address\n");
196 Serial.println(
"\n*****************************************************************");
209 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)");
211 if (*selected_dac == 8)
212 Serial.println(
"All");
214 Serial.println(*selected_dac);
230 Serial.print(
"DAC code transmitted: 0x");
231 Serial.println(dac_code,HEX);
249 Serial.print(
"DAC code transmitted: 0x");
250 Serial.println(dac_code,HEX);
283 Serial.print(F(
"Type 1 to enter voltage, 2 to enter code:"));
286 Serial.println(user_input);
300 Serial.print(F(
"Enter Desired DAC output voltage: "));
302 Serial.print(dac_voltage);
303 Serial.println(
" V");
313 Serial.println(
"Enter Desired DAC Code");
314 Serial.print(
"(Format 32768, 0x8000, 0100000, or B1000000000000000): ");
317 Serial.println(returncode, HEX);
318 Serial.print(
"code corresponding to voltage: ");
320 Serial.println(
" V");
329 Serial.println(F(
"*****************************************************************"));
330 Serial.println(F(
"* DC935 Demonstration Program *"));
331 Serial.println(F(
"* *"));
332 Serial.println(F(
"* This program demonstrates how to send data to the LTC2605 *"));
333 Serial.println(F(
"* octo 16/14/12-bit DAC found on the DC935 demo board. *"));
334 Serial.println(F(
"* *"));
335 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
336 Serial.println(F(
"* *"));
337 Serial.println(F(
"*****************************************************************"));
343 Serial.println(F(
"\nCommand Summary:"));
344 Serial.println(F(
" 1-Select DAC"));
345 Serial.println(F(
" 2-Write to input register (no update)"));
346 Serial.println(F(
" 3-Write and update DAC"));
347 Serial.println(F(
" 4-Update / power up DAC"));
348 Serial.println(F(
" 5-Power down DAC"));
351 Serial.println(
"\nPresent Values:");
352 Serial.print(
" Selected DAC: ");
353 if (selected_dac != 4)
354 Serial.println((
char) (selected_dac + 0x41));
356 Serial.println(
"All");
362 Serial.print(
" DAC Reference: ");
364 Serial.println(
"Internal");
367 Serial.print(F(
"External "));
369 Serial.println(F(
"V reference, please verify"));
370 Serial.print(F(
"Enter a command:"));
static uint8_t demo_board_connected
Set to 1 if the board is connected.
#define LTC2605_CMD_NO_OPERATION
No operation.
#define LTC2605_CMD_UPDATE
Update (power up) DAC register n.
unsigned char user_command
static int16_t LTC2605_offset
DAC offset.
#define LTC2605_CMD_POWER_DOWN
Power down n.
static int8_t menu_2_write_to_input_register(int16_t selected_dac)
Write data to input register, but do not update DAC output.
const uint8_t address_map[9]
Lookup table for DAC address.
Header File for Linduino Libraries and Demo Code.
#define LTC2605_I2C_ADDRESS
static uint8_t shift_count
The data align shift count.
uint16_t LTC2605_voltage_to_code(float dac_voltage, float LTC2605_lsb, int16_t LTC2605_offset)
Calculate a LTC2605 DAC code given the desired output voltage.
static void setup()
Initialize Linduino.
#define LTC2605_CMD_WRITE_UPDATE
Write to input register n, update (power up) all.
static int8_t menu_3_write_and_update_dac(int16_t selected_dac)
Write data to DAC register (which updates output immediately)
static void print_title()
Prints the title block when program first starts.
static float reference_voltage
Reference voltage, either internal or external.
static uint16_t get_voltage(float LTC2605_lsb, int16_t LTC2605_offset)
Get voltage from user input, calculate DAC code based on lsb, offset.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void loop()
Repeats Linduino loop.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
#define LTC2605_CMD_WRITE
Write to input register n.
static int8_t menu_5_power_down_dac(int16_t selected_dac)
Power down DAC.
static int8_t calibrate_dac(uint8_t index)
int8_t LTC2605_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 LTC2605.
float LTC2605_code_to_voltage(uint16_t dac_code, float LTC2605_lsb, int16_t LTC2605_offset)
Calculate the LTC2605 DAC output voltage given the DAC code, offset, and LSB value.
static uint16_t get_code()
Get code to send to DAC directly, in decimal, hex, or binary.
#define REF_INTERNAL
Stored reference state is Internal.
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.
static void print_prompt(int16_t selected_dac)
Prints main menu.
static uint8_t reference_mode
Tells whether to set internal or external reference.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
static int8_t menu_1_select_dac(int16_t *selected_dac)
Select which DAC to operate on.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
static int16_t prompt_voltage_or_code()
Prompt user to enter a voltage or digital code to send to DAC.
LTC2605: Octal 16-/14-/12-Bit Rail-to Rail DACs in 16-Lead SSOP.