108 #define REJECTION50_60 0 109 #define REJECTION50 1
110 #define REJECTION60 2
147 Serial.begin(115200);
161 uint8_t acknowledge = 0;
164 if (Serial.available())
167 if (user_command ==
'm');
169 Serial.println(user_command);
171 switch (user_command)
189 Serial.println(
"Incorrect Option");
193 Serial.println(F(
"***** SPI ERROR *****"));
194 Serial.println(F(
"*****************************************************************"));
206 Serial.println(F(
"*****************************************************************"));
207 Serial.println(F(
"* DC939A Demonstration Program *"));
208 Serial.println(F(
"* *"));
209 Serial.println(F(
"* This program demonstrates how to send data and receive data *"));
210 Serial.println(F(
"* from the 24-bit delta-sigma ADC. *"));
211 Serial.println(F(
"* *"));
212 Serial.println(F(
"* *"));
213 Serial.println(F(
"* Set the baud rate to 115200 select the newline terminator. *"));
214 Serial.println(F(
"* *"));
215 Serial.println(F(
"*****************************************************************"));
221 Serial.println(F(
"\nPresent Values:"));
222 Serial.print(F(
" Rejection: "));
226 Serial.println(F(
"50-60Hz rejection"));
229 Serial.println(F(
"50Hz rejection"));
232 Serial.println(F(
"60Hz rejection"));
235 Serial.print(F(
" 2X Speed: "));
236 Serial.println(
adc_2x, DEC);
237 Serial.print(F(
" Offset Code="));
239 Serial.print(F(
" LSB="));
241 Serial.println(F(
"nV (32-bits)"));
242 Serial.print(F(
" R0="));
244 Serial.print(F(
" T0="));
246 Serial.println(F(
"C"));
248 Serial.println(F(
"Command Summary:"));
249 Serial.println(F(
" 0-Read"));
250 Serial.println(F(
" 1-Set Rejection"));
251 Serial.println(F(
" 2-Set 2X Speed"));
252 Serial.println(F(
" 3-Calibrate Voltage"));
253 Serial.println(F(
" 4-Calibrate Temperature"));
255 Serial.print(F(
"Enter a command:"));
273 Serial.println(F(
"Calibration Restored"));
278 Serial.println(F(
"Calibration not found"));
292 Serial.println(F(
"Calibration Stored to EEPROM"));
337 float adc_temperature;
348 Serial.println(F(
"\nVoltage Measurement"));
349 Serial.print(F(
" Received Code: 0x"));
350 Serial.println(adc_code, HEX);
351 Serial.print(F(
" Voltage:"));
353 Serial.print(adc_voltage, 6);
354 Serial.println(F(
"V "));
359 Serial.println(F(
"\nTemperature Measurement"));
360 Serial.print(F(
" Received Code: 0x"));
361 Serial.println(adc_code, HEX);
362 Serial.print(F(
" Sensor Voltage:"));
364 Serial.print(adc_voltage, 6);
365 Serial.println(F(
"V"));
366 Serial.print(F(
" Temperature:"));
368 Serial.print(adc_temperature, 1);
369 Serial.println(F(
"C\n"));
379 Serial.println(F(
"Rejection :"));
380 Serial.println(F(
" 0: 50-60Hz rejection"));
381 Serial.println(F(
" 1: 50Hz rejection"));
382 Serial.println(F(
" 2: 60Hz rejection"));
384 Serial.print(F(
"Select Rejection:"));
386 Serial.println(user_command);
387 switch (user_command)
408 Serial.print(F(
"Select 2X Rate (0-OFF, 1-ON): "));
410 Serial.println(user_command);
411 switch (user_command)
438 Serial.println(F(
"Short the inputs to ground calibrate the offset."));
439 Serial.println(F(
"or apply a voltage for the lower point in two point calibration"));
440 Serial.print(F(
"Enter the measured input voltage:"));
442 Serial.println(zero_voltage, 6);
452 Serial.println(F(
"Apply ~2.40V to +IN"));
453 Serial.println(F(
"Enter the measured input voltage:"));
466 Serial.print(F(
"ADC offset : "));
468 Serial.print(F(
" ADC lsb : "));
470 Serial.println(F(
"nV (32-bits)"));
479 float adc_cal_temperature;
483 Serial.println(F(
"Enter the actual temperature(C):"));
static void loop()
Repeats Linduino loop.
static void setup()
Initialize Linduino.
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.
static int8_t adc_rejection
The LTC2484 rejection.
LTC2484: 24-Bit Delta Sigma ADC with Easy Drive Input Current Cancellation.
unsigned char user_command
static uint8_t adc_command
#define EEPROM_I2C_ADDRESS
#define LTC2484_TEMPERATURE_INPUT
#define LTC2484_AUTO_CALIBRATION
#define LTC2484_REJECTION_50HZ_60HZ
static void print_title()
Prints the title block when program first starts.
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.
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.
static float LTC2484_t0
Nominal temperature.
static int32_t LTC2484_offset_code
Ideal offset.
static float LTC2484_r0
ADC code at the nominal temperature (420mV default)
static uint8_t menu_4_calibrate_temperature()
Calibrate Temperature given two known inputs.
#define REJECTION60
60Hz rejection
float LTC2484_code_to_voltage(int32_t adc_code, float LTC2484_lsb, int32_t LTC2484_offset_code)
Calculates the LTC2484 input bipolar voltage.
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
float LTC2484_temperature(int32_t adc_code, float LTC2484_t0, float LTC2484_r0)
Calculate the LTC2484 temperature.
void LTC2484_cal_voltage(int32_t zero_code, int32_t fs_code, float zero_voltage, float fs_voltage, float *LTC2484_lsb, int32_t *LTC2484_offset_code)
Calibrate the lsb.
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.
void LTC2484_read(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Read LTC2484 result, program configuration for next conversion.
static void menu_1_set_rejection()
Set rejection mode.
static float LTC2484_lsb
Ideal LSB size, 5V/(2^29) for a 5V reference.
static uint8_t menu_3_calibrate_voltage()
Calibrate ADC given two known inputs.
void LTC2484_cal_temperature(int32_t adc_code, float temperature, float *LTC2484_t0, float *LTC2484_r0)
Calibrate temperature.
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
static int8_t adc_2x
The LTC2484 2x speed mode.
#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.
#define LTC2484_EXTERNAL_INPUT
#define REJECTION50
50Hz rejection
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static uint8_t demo_board_connected
Set to 1 if the board is connected.
static void menu_2_set_1X_2X()
Select 1X or 2X mode.
static void store_calibration()
Store measured calibration parameters to nonvolatile EEPROM on demo board.
#define LTC2484_REJECTION_50HZ
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
int8_t LTC2484_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
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...
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.
#define REJECTION50_60
50-60Hz rejection
static uint8_t menu_0_read()
Read ADC.
static uint8_t build_adc_command(uint8_t temperature)
Construct ADC command from rejection, input, and 2X parameters.
#define LTC2484_CS
define the SPI CS pin
#define LTC2484_REJECTION_60HZ
static void print_prompt()
Prints main menu.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
const uint16_t MISO_TIMEOUT
The MISO timeout (ms)
static int8_t restore_calibration()
Read stored calibration parameters from nonvolatile EEPROM on demo board.