110 voltage = (float)adc_code;
111 voltage = voltage / (pow(2,16)-1);
116 if ((adc_code & 0x8000) == 0x8000)
118 adc_code = (adc_code ^ 0xFFFF)+1;
121 voltage = sign*(float)adc_code;
122 voltage = voltage / (pow(2,15)-1);
124 voltage = voltage *
vref;
static uint8_t adc_command
static uint8_t uni_bipolar
Default set for unipolar mode.
Header File for Linduino Libraries and Demo Code.
int8_t LTC2305_read(uint8_t i2c_address, uint8_t adc_command, uint16_t *ptr_adc_code)
Reads 12-bit code from LTC2305, programs channel and mode for next conversion.
union LT_union_int32_4bytes data
float LTC2305_code_to_voltage(uint16_t adc_code, float vref, uint8_t uni_bipolar)
Calculates the LTC2305 input voltage.
uint16_t LT_uint16
16-bit unsigned integer to be converted to two bytes
int8_t i2c_read_word_data(uint8_t address, uint8_t command, uint16_t *value)
Read a 16-bit word of data from register specified by "command".
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
#define LTC2305_UNIPOLAR_MODE
This union splits one int16_t (16-bit signed integer) or uint16_t (16-bit unsigned integer) into two ...
uint8_t LT_byte[2]
2 bytes (unsigned 8-bit integers) to be converted to a 16-bit signed or unsigned integer ...
LTC2305: 8-channel, 12-Bit SAR ADC with I2C interface.