96 float_code = (float_code > (floor(float_code) + 0.5)) ? ceil(float_code) : floor(float_code);
97 dac_code = (int32_t)float_code - LTC2655_offset;
100 return ((uint16_t)dac_code);
107 dac_voltage = ((float)(dac_code + LTC2655_offset)*
LTC2655_lsb);
108 return (dac_voltage);
115 *LTC2655_lsb = (voltage2 - voltage1) / ((
float) (dac_code2 - dac_code1));
116 temp_offset = (voltage1/(*LTC2655_lsb) - (float)dac_code1);
117 temp_offset = (temp_offset > (floor(temp_offset) + 0.5)) ? ceil(temp_offset) : floor(temp_offset);
118 *LTC2655_offset = (int16_t)temp_offset;
LTC2655: Quad I2C 16-/12-Bit Rail-to-Rail DACs with 10ppm/C Max Reference.
static float LTC2655_lsb[5]
The LTC2655 lsb - index 4 for "all DACs." If part is calibrated, then index 0 is stored to "all DACs...
void LTC2655_calibrate(uint16_t dac_code1, uint16_t dac_code2, float voltage1, float voltage2, float *LTC2655_lsb, int16_t *LTC2655_offset)
Calculate the LTC2655 offset and LSB voltages given two measured voltages and their corresponding cod...
Header File for Linduino Libraries and Demo Code.
static int16_t LTC2655_offset[5]
DAC offset - index 4 for "all DACs." If part is calibrated, then index 0 is stored to "all DACs...
uint16_t LTC2655_voltage_to_code(float dac_voltage, float LTC2655_lsb, int16_t LTC2655_offset)
Calculate a LTC2655 DAC code given the desired output voltage.
int8_t i2c_write_word_data(uint8_t address, uint8_t command, uint16_t value)
Write a 16-bit word of data to register specified by "command".
int8_t LTC2655_write(uint8_t i2c_address, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write a 16-bit dac_code to the LTC2655.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
float LTC2655_code_to_voltage(uint16_t dac_code, float LTC2655_lsb, int16_t LTC2655_offset)
Calculate the LTC2655 DAC output voltage given the DAC code, offset, and LSB value.