134 Serial.begin(115200);
151 if (Serial.available())
155 Serial.println(user_command);
157 switch (user_command)
179 Serial.println(
"***** INCORRECT ENTRY *****");
184 Serial.println(
"Error: No Acknowledge. Check I2C Address.");
185 Serial.println(
"***** ACK ERROR *****");
188 Serial.println(
"\n*****************************************************************");
200 Serial.println(
"*****************************************************************");
201 Serial.println(
"* DC1491A Demonstration Program *");
202 Serial.println(
"* *");
203 Serial.println(
"* This program demonstrates how to send data and receive data *");
204 Serial.println(
"* from the LTC2461 16-bit ADC. *");
205 Serial.println(
"* *");
206 Serial.println(
"* *");
207 Serial.println(
"* Set the baud rate to 115200 and select the newline terminator.*");
208 Serial.println(
"* *");
209 Serial.println(
"*****************************************************************");
216 Serial.println(
"1-Read ADC Voltage");
217 Serial.println(
"2-Sleep Mode");
218 Serial.println(
"3-60 Hz Speed Mode");
219 Serial.println(
"4-Calibration");
221 Serial.print(
"Enter a command:");
231 Serial.println(
"Calibration Stored to EEPROM");
249 Serial.println(
"Calibration Restored");
254 Serial.println(
"Calibration not found");
263 uint16_t adc_code_30Hz;
266 Serial.print(
"ADC Command: b");
272 Serial.print(
"Received Code: 0x");
273 Serial.println(adc_code_30Hz, HEX);
279 float adc_voltage_30Hz;
282 Serial.print(
"Voltage Reading: ");
283 Serial.print(adc_voltage_30Hz, 4);
296 Serial.print(
"ADC Command: b");
301 Serial.println(
"***** LTC2461 In Sleep Mode ******");
310 uint16_t adc_code_60Hz;
313 Serial.print(
"ADC Command: b");
319 Serial.print(
"Received Code: 0x");
320 Serial.println(adc_code_60Hz, HEX);
326 float adc_voltage_60Hz;
329 Serial.print(
"Voltage Reading: ");
330 Serial.print(adc_voltage_60Hz, 4);
332 Serial.println(
"*** 60 Hz Speed Mode ***");
345 Serial.println(
"Apply 100mV to the input.");
346 Serial.println(
"or apply a voltage for the lower point in two point calibration");
347 Serial.print(
"Enter the measured input voltage:");
349 Serial.println(zero_voltage, 6);
355 Serial.println(
"Apply ~1.20V input voltage to input.");
356 Serial.println(
"Enter the measured input voltage:");
359 Serial.println(fs_voltage, 6);
367 Serial.print(
"ADC offset code: ");
370 Serial.print(
"ADC calibrated lsb size : ");
372 Serial.println(
" uV (16-bits)");
#define LTC2461_60HZ_SPEED_MODE
uint8_t eeprom_read_int16(uint8_t i2c_address, int16_t *read_data, uint16_t address)
Read the two byte integer data from the EEPROM starting at address.
unsigned char user_command
#define EEPROM_I2C_ADDRESS
int8_t LTC2461_read(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads the ADC and returns 16-bit data.
static float LTC2461_lsb
Ideal LSB voltage for a perfect part (Vref/(2^16))
Header File for Linduino Libraries and Demo Code.
uint8_t eeprom_read_float(uint8_t i2c_address, float *read_data, uint16_t address)
Read the four byte float data from the EEPROM starting at address.
static int8_t menu_4_calibrate()
Calibrate the LTC2461.
uint8_t eeprom_write_int32(uint8_t i2c_address, int32_t write_data, uint16_t address)
Write the 4 byte long data to the EEPROM starting at address.
void LTC2461_cal_voltage(uint16_t zero_code, uint16_t fs_code, float zero_voltage, float fs_voltage, float *LTC2461_lsb, int32_t *LTC2461_offset_code)
Calibrate the lsb.
static void print_prompt()
Prints main menu.
static void loop()
Repeats Linduino loop.
static int8_t menu_2_sleep_mode()
Sleep Mode.
#define LTC2461_30HZ_SPEED_MODE
static void print_title()
Prints the title block when program first starts.
#define LTC2461_I2C_ADDRESS
uint8_t eeprom_write_float(uint8_t i2c_address, float write_data, uint16_t address)
Write the 4 byte float data to the EEPROM starting at address.
uint8_t eeprom_write_int16(uint8_t i2c_address, int16_t write_data, uint16_t address)
Write the 2 byte integer data to the EEPROM starting at address.
static void setup()
Initialize Linduino.
#define EEPROM_CAL_STATUS_ADDRESS
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
static int8_t restore_calibration()
Read stored calibration parameters from nonvolatile EEPROM on demo board.
static uint8_t demo_board_connected
Set to 1 if the board is connected.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
int8_t LTC2461_command(uint8_t i2c_address, uint8_t adc_command)
Write a 16-bit command to the ADC.
static int32_t LTC2461_offset_code
Ideal offset for a perfect part.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
uint8_t eeprom_read_int32(uint8_t i2c_address, int32_t *read_data, uint16_t address)
Read the four byte long data from the EEPROM starting at address.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
LTC2461: 16-Bit I2C Delta Sigma ADCs with 10ppm/C Max Precision Reference.
static void store_calibration()
Store measured calibration parameters to nonvolatile EEPROM on demo board.
static int8_t menu_3_read_60Hz_mode()
Read ADC in 60 Hz mode.
static int8_t menu_1_read_30Hz_mode()
Read ADC in 30 Hz mode.
float LTC2461_code_to_voltage(uint16_t adc_code, float LTC2461_lsb, int32_t LTC2461_offset_code)
Calculates the LTC2309 input unipolar voltage.
#define LTC2461_SLEEP_MODE