Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

Library for LTC2607: 16-Bit, Dual Rail-to-Rail DACs with I2C Interface. More...

Detailed Description

Library for LTC2607: 16-Bit, Dual Rail-to-Rail DACs with I2C Interface.

Definition in file LTC2607.cpp.

Go to the source code of this file.

Functions

int8_t LTC2607_write (uint8_t i2c_address, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
 Writes command, DAC address, and DAC code to the LTC2607. More...
 
uint16_t LTC2607_voltage_to_code (float dac_voltage, float LTC2607_lsb, int32_t LTC2607_offset)
 Calculates an LTC2607 DAC code for the desired output voltage. More...
 
void LTC2607_calibrate (uint16_t dac_code1, uint16_t dac_code2, float voltage1, float voltage2, float *LTC2607_lsb, int32_t *LTC2607_offset)
 Calculates the LTC2607 offset and lsb voltage given two measured voltages and their corresponding DAC codes. More...
 

Function Documentation

◆ LTC2607_calibrate()

void LTC2607_calibrate ( uint16_t  dac_code1,
uint16_t  dac_code2,
float  voltage1,
float  voltage2,
float *  LTC2607_lsb,
int32_t *  LTC2607_offset 
)

Calculates the LTC2607 offset and lsb voltage given two measured voltages and their corresponding DAC codes.

Prior to calling this function, write two DAC codes to the LTC2607, and measure the output voltage for each DAC code. When passed the DAC codes and measured voltages as parameters, this function calculates the calibrated lsb and offset values.

Parameters
dac_code1DAC Code 1.
dac_code2DAC Code 2.
voltage1Measured output voltage corresponding to DAC Code 1.
voltage2Measured output voltage corresponding to DAC Code 2.
LTC2607_lsbOverwritten with new calculated lsb voltage.
LTC2607_offsetOverwritten with new calculated offset voltage.

Definition at line 127 of file LTC2607.cpp.

◆ LTC2607_voltage_to_code()

uint16_t LTC2607_voltage_to_code ( float  dac_voltage,
float  LTC2607_lsb,
int32_t  LTC2607_offset 
)

Calculates an LTC2607 DAC code for the desired output voltage.

Based on the desired output voltage, the offset, and lsb parameters, return the corresponding DAC code that should be written to the LTC2607.

Returns
DAC code for desired output voltage
Parameters
dac_voltageDesired DAC output voltage.
LTC2607_lsbThe LSB weight. Use calibrated value for best results, otherwise use typical value from datasheet.
LTC2607_offsetThe offset voltage. Use calibrated value for best results, otherwise use typical value from datasheet.

Definition at line 110 of file LTC2607.cpp.

◆ LTC2607_write()

int8_t LTC2607_write ( uint8_t  i2c_address,
uint8_t  dac_command,
uint8_t  dac_address,
uint16_t  dac_code 
)

Writes command, DAC address, and DAC code to the LTC2607.

Configures command (write, update, power down, etc.), address (DAC A, DAC B, or BOTH), and 16-bit dac_code for output voltage.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of the LTC2607. Configured by CA0, CA1, and CA2 pins. See Table 1 of datasheet.
dac_commandDAC command (4-bits) that will be written to LTC2607. (Write, update, power down, etc.)
dac_addressDAC address (4-bits) that will be written to LTC2607. Configures DAC A, DAC B, or both.
dac_codeDAC code that will be written to LTC2607. This configures the output voltage.

Definition at line 100 of file LTC2607.cpp.