136 Serial.begin(115200);
146 Serial.println(F(
"EEPROM not detected, will attempt to proceed"));
156 uint8_t acknowledge = 0;
159 if (Serial.available())
162 if (user_command !=
'm')
163 Serial.println(user_command);
165 switch (user_command)
177 Serial.println(F(
"Incorrect Option"));
180 Serial.println(F(
"***** I2C ERROR *****"));
181 Serial.print(F(
"\n*************************\n"));
192 Serial.print(F(
"\n*****************************************************************\n"));
193 Serial.print(F(
"* DC1012A-B Demonstration Program *\n"));
194 Serial.print(F(
"* *\n"));
195 Serial.print(F(
"* This program demonstrates how to send data and receive data *\n"));
196 Serial.print(F(
"* from the 16-bit ADC. *\n"));
197 Serial.print(F(
"* *\n"));
198 Serial.print(F(
"* *\n"));
199 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
200 Serial.print(F(
"* *\n"));
201 Serial.print(F(
"*****************************************************************\n"));
207 Serial.print(F(
"\n1-Read Single-Ended\n"));
208 Serial.print(F(
"2-Read Differential\n"));
209 Serial.print(F(
"3-Set I2C Address\n"));
210 Serial.print(F(
"Enter a Command: "));
220 Serial.print(F(
"0P-1N"));
223 Serial.print(F(
"2P-3N"));
226 Serial.print(F(
"4P-5N"));
229 Serial.print(F(
"6P-7N"));
232 Serial.print(F(
"8P-9N"));
235 Serial.print(F(
"10P-11N"));
238 Serial.print(F(
"12P-13N"));
241 Serial.print(F(
"14P-15N"));
244 Serial.print(F(
"1P-0N"));
247 Serial.print(F(
"3P-2N"));
250 Serial.print(F(
"5P-4N"));
253 Serial.print(F(
"7P-6N"));
256 Serial.print(F(
"9P-8N"));
259 Serial.print(F(
"11P-10N"));
262 Serial.print(F(
"13P-12N"));
265 Serial.print(F(
"15P-14N"));
268 Serial.print(F(
": "));
284 Serial.print(F(
"*************************\n\n"));
285 Serial.print(F(
"0-CH0 8-CH8\n"));
286 Serial.print(F(
"1-CH1 9-CH9\n"));
287 Serial.print(F(
"2-CH2 10-CH10\n"));
288 Serial.print(F(
"3-CH3 11-CH11\n"));
289 Serial.print(F(
"4-CH4 12-CH12\n"));
290 Serial.print(F(
"5-CH5 13-CH13\n"));
291 Serial.print(F(
"6-CH6 14-CH14\n"));
292 Serial.print(F(
"7-CH7 15-CH15\n"));
293 Serial.print(F(
"16-ALL\n"));
294 Serial.print(F(
"m-Main Menu\n"));
295 Serial.print(F(
"Enter a Command: "));
298 if (user_command ==
'm')
300 Serial.println(user_command);
302 if (user_command == 16)
304 Serial.print(F(
"ALL\n"));
308 for (int8_t
x = 0;
x <= 15;
x++)
318 Serial.print(F(
" ****"));
319 Serial.print(F(
"CH"));
321 Serial.print(F(
": "));
322 Serial.print(adc_voltage, 4);
323 Serial.print(F(
"V\n\n"));
327 Serial.print(F(
" ****"));
328 Serial.print(F(
"CH"));
330 Serial.print(F(
": "));
331 Serial.print(F(
"Error in read"));
339 Serial.print(F(
"ADC Command: 0x"));
340 Serial.println(adc_command, HEX);
341 Serial.print(F(
"I2C address is: "));
352 Serial.print(F(
"Received Code: 0x"));
353 Serial.println(adc_code, HEX);
355 Serial.print(F(
" ****"));
356 Serial.print(F(
"CH"));
357 Serial.print(user_command);
358 Serial.print(F(
": "));
359 Serial.print(adc_voltage, 4);
360 Serial.print(F(
"V\n\n"));
364 Serial.println(F(
"Device NAK'd, please check address and try again"));
386 Serial.print(F(
"\n*************************\n\n"));
387 Serial.print(F(
"0-0P-1N 8-1P-0N\n"));
388 Serial.print(F(
"1-2P-3N 9-3P-2N\n"));
389 Serial.print(F(
"2-4P-5N 10-5P-4N\n"));
390 Serial.print(F(
"3-6P-7N 11-7P-6N\n"));
391 Serial.print(F(
"4-8P-9N 12-9P-8N\n"));
392 Serial.print(F(
"5-10P-11N 13-11P-10N\n"));
393 Serial.print(F(
"6-12P_13N 14-13P-12N\n"));
394 Serial.print(F(
"7-14P-15N 15-15P-14N\n"));
395 Serial.print(F(
"16-ALL Even_P-Odd_N\n"));
396 Serial.print(F(
"17-ALL Odd_P-Even_N\n"));
397 Serial.print(F(
"m-Main Menu\n"));
400 if (user_command ==
'm')
402 Serial.println(user_command);
404 if ((user_command == 16) || (user_command == 17))
406 if (user_command == 16)
408 Serial.print(F(
"ALL Even_P-Odd_N\n"));
411 if (user_command == 17)
413 Serial.print(F(
"ALL Odd_P-Even_N\n"));
420 for (int8_t
x = 0;
x < 8;
x++)
429 Serial.print(F(
"Received Code: 0x"));
430 Serial.println(adc_code, HEX);
432 Serial.print(F(
"\n ****"));
434 Serial.print(F(
": "));
435 Serial.print(adc_voltage, 4);
436 Serial.print(F(
"V\n"));
440 Serial.println(F(
"Device NAK'd, please check I2C address"));
449 Serial.print(F(
"ADC Command: 0x"));
450 Serial.println(adc_command, HEX);
458 Serial.print(F(
"Received Code: 0x"));
459 Serial.println(adc_code, HEX);
461 Serial.print(F(
"\n ****"));
463 Serial.print(adc_voltage, 4);
464 Serial.print(F(
"V\n"));
468 Serial.println(F(
"Device NAK'd, please check I2C address"));
480 Serial.print(F(
"What is the I2C address of the part?\n"));
481 Serial.print(F(
"Please enter in 7-bit format, decimal\n"));
484 Serial.println(user_command);
#define LTC24XX_MULTI_CH_CH3
#define LTC24XX_MULTI_CH_CH14
const uint8_t BUILD_COMMAND_SINGLE_ENDED[16]
Lookup table to build the command for single-ended mode.
unsigned char user_command
static uint8_t adc_command
#define LTC24XX_MULTI_CH_CH8
#define LTC24XX_MULTI_CH_CH15
static void menu_3_set_address()
Set the I2C 7 bit address.
LTC2497: 16-Bit, 16-Channel Delta Sigma ADCs with Easy Drive Input Current Cancellation.
#define LTC24XX_MULTI_CH_CH13
#define LTC24XX_MULTI_CH_CH1
#define LTC24XX_MULTI_CH_CH6
#define LTC24XX_MULTI_CH_P13_N12
#define LTC24XX_MULTI_CH_P1_N0
Header File for Linduino Libraries and Demo Code.
float LTC2497_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference (in volts) ...
#define LTC24XX_MULTI_CH_CH5
#define LTC24XX_MULTI_CH_P4_N5
static void setup()
Initialize Linduino.
#define LTC24XX_MULTI_CH_CH0
#define LTC24XX_MULTI_CH_CH11
#define LTC2497_I2C_ADDRESS
I2C address of the LTC2497.
uint8_t LTC2497_read(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t timeout)
Reads from LTC2497.
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
#define LTC24XX_MULTI_CH_P9_N8
#define LTC24XX_MULTI_CH_P14_N15
#define LTC24XX_MULTI_CH_CH2
static int8_t menu_2_read_differential()
Read channels in differential mode.
static uint8_t demo_board_connected
Set to 1 if the board is connected.
static int8_t menu_1_read_single_ended()
Read channels in single-ended mode.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
const uint8_t BUILD_COMMAND_DIFF[16]
Lookup table to build the command for differential mode.
#define LTC24XX_MULTI_CH_P3_N2
#define LTC24XX_MULTI_CH_P2_N3
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
#define LTC24XX_MULTI_CH_P10_N11
#define LTC24XX_MULTI_CH_CH12
#define LTC24XX_MULTI_CH_P12_N13
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
#define LTC24XX_MULTI_CH_CH7
static float LTC2497_vref
The ideal reference voltage.
#define LTC24XX_MULTI_CH_P5_N4
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
#define LTC24XX_MULTI_CH_P8_N9
#define LTC24XX_MULTI_CH_P7_N6
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
static void loop()
Repeats Linduino loop.
#define LTC24XX_MULTI_CH_CH10
#define LTC24XX_MULTI_CH_CH9
#define LTC24XX_MULTI_CH_P15_N14
static void print_user_command(uint8_t menu)
Display selected differential channels.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
#define LTC24XX_MULTI_CH_P11_N10
static uint16_t timeout
300 ms timeout
static uint8_t i2c_address
I2C address in 7 bit format for part.
static void print_prompt()
Prints main menu.
#define LTC24XX_MULTI_CH_P0_N1
#define LTC24XX_MULTI_CH_CH4
static void print_title()
Prints the title block when program first starts.
#define LTC24XX_MULTI_CH_P6_N7