105 adc_code -= 0x20000000;
106 return (((((
float) adc_code) / LTC2484_r0) * (LTC2484_t0 + 273)) - 273);
112 zero_code -= 0x20000000;
113 fs_code -= 0x20000000;
116 *LTC2484_lsb = (fs_voltage-zero_voltage)/((
float)(fs_code - zero_code));
118 temp_offset = (zero_voltage/ *
LTC2484_lsb) - zero_code;
119 temp_offset = (temp_offset > (floor(temp_offset) + 0.5)) ? ceil(temp_offset) : floor(temp_offset);
120 *LTC2484_offset_code = (int32_t)temp_offset;
126 adc_code -= 0x20000000;
127 *LTC2484_r0 = (float) adc_code;
128 *LTC2484_t0 = temperature;
LTC2484: 24-Bit Delta Sigma ADC with Easy Drive Input Current Cancellation.
static uint8_t adc_command
Header File for Linduino Libraries and Demo Code.
int8_t LTC24XX_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
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)
float LTC24XX_diff_code_to_calibrated_voltage(int32_t adc_code, float LTC2449_lsb, int32_t LTC2449_offset_code)
Calculates the voltage corresponding to an ADC code, given lsb weight (in volts) and the calibrated A...
void LTC24XX_SPI_8bit_command_32bit_data(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
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.
void LTC2484_read(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Read LTC2484 result, program configuration for next conversion.
static float LTC2484_lsb
Ideal LSB size, 5V/(2^29) for a 5V reference.
void LTC2484_cal_temperature(int32_t adc_code, float temperature, float *LTC2484_t0, float *LTC2484_r0)
Calibrate temperature.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
int8_t LTC2484_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.