141 Serial.begin(115200);
151 uint8_t acknowledge = 0;
153 if (Serial.available())
156 if (user_command !=
'm')
157 Serial.println(user_command);
159 switch (user_command)
183 Serial.println(F(
"Invalid Option"));
187 if (acknowledge != 0) Serial.println(F(
"Error: No Acknowledge. Check I2C Address."));
188 Serial.println(F(
"*************************"));
202 uint8_t
x, y, startcount, endcount;
205 uint8_t acknowledge = 0;
213 Serial.println(F(
" Read LTC2305 Input in Single-Ended Unipolar mode:"));
214 Serial.println(F(
" Note that in Unipolar mode, input voltages less than zero are reported as 0.0V"));
217 Serial.println(F(
" Read LTC2305 Input in Single-Ended Bipolar mode:"));
224 Serial.println(F(
" Read LTC2305 Input in Differential Unipolar mode:"));
225 Serial.println(F(
" Note that in Unipolar mode, input voltages less than zero are reported as 0.0V"));
228 Serial.println(F(
" Read LTC2305 Input in Differential Bipolar mode:"));
236 Serial.println(F(
" Read LTC2301 Input in Differential Unipolar mode:"));
237 Serial.println(F(
" Note that in Unipolar mode, input voltages less than zero are reported as 0.0V"));
240 Serial.println(F(
" Read LTC2301 Input in Differential Bipolar mode:"));
243 if (user_command == 8)
258 for (int8_t x = startcount; x <= endcount; x++)
265 display_code = display_code & 0xFFF;
267 Serial.print(F(
" Received Code: b"));
268 Serial.println(display_code, BIN);
271 Serial.print(F(
" Voltage read on "));
272 Serial.print(F(
"Ch"));
274 Serial.print(F(
": "));
275 Serial.print(adc_voltage, 4);
276 Serial.println(F(
"V"));
288 display_code = display_code & 0xFFF;
290 Serial.print(F(
" Received Code: b"));
291 Serial.println(display_code, BIN);
294 Serial.print(F(
" Voltage read on "));
295 Serial.print(F(
"Ch"));
297 Serial.print(F(
": "));
298 Serial.print(adc_voltage, 4);
299 Serial.println(F(
"V"));
311 display_code = display_code & 0xFFF;
313 Serial.print(F(
" Received Code: b"));
314 Serial.println(display_code, BIN);
317 Serial.print(F(
" Voltage read on "));
318 Serial.print(F(
"Ch"));
319 Serial.print(user_command);
320 Serial.print(F(
": "));
321 Serial.print(adc_voltage, 4);
322 Serial.println(F(
"V"));
334 Serial.println(F(
"\n 0 = LTC2301"));
335 Serial.println(F(
" 1 = LTC2305"));
336 Serial.print(F(
" Enter a Command: "));
339 Serial.println(user_command);
340 switch (user_command)
343 Serial.println(F(
" LTC2301 selected"));
347 Serial.println(F(
" LTC2305 selected"));
352 Serial.println(
" Invalid Option");
365 Serial.println(F(
"\n 0 = Unipolar"));
366 Serial.println(F(
" 1 = Bipolar"));
367 Serial.print(F(
" Enter a Command: "));
370 Serial.println(user_command);
371 switch (user_command)
374 Serial.println(F(
" Uniipolar mode selected"));
378 Serial.println(F(
" Bipolar mode selected"));
383 Serial.println(
" Invalid Option");
396 Serial.println(F(
"\n 0 = Single-Ended"));
397 Serial.println(F(
" 1 = Differential"));
398 Serial.print(F(
" Enter a Command: "));
401 Serial.println(user_command);
402 switch (user_command)
405 Serial.println(F(
" Single-ended mode selected"));
410 Serial.println(F(
" Differential mode selected"));
415 Serial.println(
" Invalid Option");
428 Serial.println(F(
"\n 0 = 0P-1N"));
429 Serial.println(F(
" 1 = 1P-0N"));
430 Serial.print(F(
" Enter a Command: "));
433 Serial.println(user_command);
434 switch (user_command)
437 Serial.println(F(
" 0P-1N selected"));
441 Serial.println(F(
" 1P-0N selected"));
446 Serial.println(
" Invalid Option");
458 int8_t acknowledge = 0;
465 Serial.print(F(
" ADC Command: b"));
467 Serial.println(F(
" LTC2305 is now in sleep mode"));
468 Serial.println(F(
" Enter RETURN to exit Sleep Mode"));
481 Serial.print(F(
" Enter the I2C address of the part in decimal format, from 0 to 127 (default is 8)\n"));
483 Serial.print(F(
" Address entered: "));
484 Serial.println(user_command);
493 Serial.println(F(
"*****************************************************************"));
494 Serial.println(F(
"* DC1444A Demonstration Program *"));
495 Serial.println(F(
"* This program demonstrates how to receive data *"));
496 Serial.println(F(
"* from the following ADCs: *"));
497 Serial.println(F(
"* LTC2301 *"));
498 Serial.println(F(
"* LTC2305 *"));
499 Serial.println(F(
"* *"));
500 Serial.println(F(
"* *"));
501 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
502 Serial.println(F(
"* *"));
503 Serial.println(F(
"*****************************************************************"));
510 Serial.println(F(
"1-Read ADC Input "));
511 Serial.println(F(
"2-Select LTC2301 / LTC2305 (default is LTC2301)"));
512 Serial.println(F(
"3-Select Unipolar / Bipolar measurement (default is Unipolar)"));
513 Serial.println(F(
"4-Select Single-Ended / Differential measurement, LTC2305 only (default is Single-Ended)"));
514 Serial.println(F(
"5-Select Polarity (default is 0+/1-)"));
515 Serial.println(F(
"6-Sleep Mode"));
516 Serial.println(F(
"7-Set I2C address (default is 8)"));
518 Serial.print(F(
"Enter a command: "));
526 Serial.println(F(
"*************************"));
527 Serial.println(F(
" 0 = CH0"));
528 Serial.println(F(
" 1 = CH1"));
529 Serial.println(F(
" 2 = ALL"));
530 Serial.println(F(
" m = Main Menu"));
532 Serial.print(F(
" Enter a Command: "));
535 Serial.println(user_command);
536 if (user_command ==
'm')
539 switch (user_command)
542 Serial.println(F(
" CH0 selected"));
545 Serial.println(F(
" CH1 selected"));
548 Serial.println(F(
" All selected"));
551 Serial.println(F(
" Invalid Option"));
555 return(user_command);
#define LTC2305_DIFFERENTIAL_MODE
unsigned char user_command
static uint8_t adc_command
static uint8_t print_user_command_single_ended()
Display selected single-ended channels.
Header File for Linduino Libraries and Demo Code.
static void setup()
Initialize Linduino.
static void menu_3_select_uni_bipolar()
Sets LTC230X to Bipolar or Unipolar.
static uint8_t uni_bipolar
LTC2305 Unipolar or Bipolar mode selection.
static void menu_2_select_part()
Sets LTC2305 to Single-Ended or Differential.
static void print_prompt()
Prints main menu.
#define LTC2305_SINGLE_ENDED_MODE
static uint8_t channel
LTC2305 Channel selection.
static void print_title()
Prints the title block when the program first starts.
static uint8_t demo_board_connected
Set to 1 if the board is connected.
int8_t LTC2305_read(uint8_t i2c_address, uint8_t adc_command, uint16_t *ptr_adc_code)
Reads 12-bit code from LTC2305, programs channel and mode for next conversion.
#define LTC2305_I2C_ADDRESS
static uint8_t i2c_address
I2C address in 7 bit format for part.
static void loop()
Repeats Linduino loop.
static uint8_t part
LTC2301 or 2305 part selection.
float LTC2305_code_to_voltage(uint16_t adc_code, float vref, uint8_t uni_bipolar)
Calculates the LTC2305 input voltage.
#define LTC2305_SLEEP_MODE
static uint8_t polarity
LTC230X Input polarity selection.
static uint8_t single_ended_differential
LTC2305 Single-Ended or Differential mode selection.
static int8_t menu_6_sleep()
Sets LTC2305 Sleep Mode.
static float LTC2305_vref
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
const uint8_t BUILD_COMMAND_SINGLE_ENDED[2]
Builds the command for single-ended mode.
static void menu_4_select_single_ended_differential()
Sets LTC2305 single-ended or differential mode.
static void menu_5_select_polarity()
Sets LTC2305 polarity in differential mode.
static int8_t menu_1_read_input()
Read channels in single-ended mode.
#define LTC2305_UNIPOLAR_MODE
static int32_t display_code
#define LTC2305_EXIT_SLEEP_MODE
static void menu_7_set_address()
Set the I2C 7 bit address.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
#define LTC2305_BIPOLAR_MODE
LTC2305: 8-channel, 12-Bit SAR ADC with I2C interface.
static uint8_t LTC2305_bits
Resolution (12 bits)