83 #define LTC2449_CS QUIKEVAL_CS 89 uint16_t timer_count = 0;
93 if (
input(MISO) == 0)
break;
94 if (timer_count++>miso_timeout)
130 adc_code -= 536870912;
131 adc_voltage=(float)(adc_code+LTC2449_offset_code)*
LTC2449_lsb;
138 zero_code -= 536870912;
139 fs_code -= 536870912;
142 *LTC2449_lsb = (fs_voltage-zero_voltage)/((
float)(fs_code - zero_code));
144 temp_offset = (zero_voltage/ *
LTC2449_lsb) - zero_code;
145 temp_offset = (temp_offset > (floor(temp_offset) + 0.5)) ? ceil(temp_offset) : floor(temp_offset);
146 *LTC2449_offset_code = (int32_t)temp_offset;
static uint8_t adc_command
uint8_t LT_byte[4]
4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer ...
#define output_high(pin)
Set "pin" high.
Header File for Linduino Libraries and Demo Code.
void LTC2449_cal_voltage(int32_t zero_code, int32_t fs_code, float zero_voltage, float fs_voltage, float *LTC2449_lsb, int32_t *LTC2449_offset_code)
Calculate the lsb weight and offset code given a full-scale code and a measured zero-code.
union LT_union_int32_4bytes data
float LTC2449_code_to_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...
int16_t LT_int16
16-bit signed integer to be converted to two bytes
#define output_low(pin)
Set "pin" low.
#define input(pin)
Return the state of pin "pin".
int32_t LT_int32
32-bit signed integer to be converted to four bytes
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
LTC2449: 24-Bit, 16-Channel Delta Sigma ADCs with Selectable Speed/Resolution.
This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer) four uint...
This union splits one int16_t (16-bit signed integer) or uint16_t (16-bit unsigned integer) into two ...
static float LTC2449_lsb
The LTC2449 ideal reference voltage.
void spi_transfer_block(uint8_t cs_pin, uint8_t *tx, uint8_t *rx, uint8_t length)
Reads and sends a byte array.
uint8_t LT_byte[2]
2 bytes (unsigned 8-bit integers) to be converted to a 16-bit signed or unsigned integer ...
static int32_t LTC2449_offset_code
Ideal offset for a perfect part.
int8_t LTC2449_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Define the SPI CS pin.
void LTC2449_read(uint8_t cs, uint16_t adc_command, uint32_t *adc_code)
Reads from LTC2449.