Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

Library for LTC24XX no-latency delta sigma ADCs with SINC4 rejection. More...

Detailed Description

Library for LTC24XX no-latency delta sigma ADCs with SINC4 rejection.

Definition in file LTC24XX_general.cpp.

Go to the source code of this file.

Functions

int8_t LTC24XX_EOC_timeout (uint8_t cs, uint16_t miso_timeout)
 Checks for EOC with a specified timeout. More...
 
void LTC24XX_SPI_32bit_data (uint8_t cs, int32_t *adc_code)
 Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result. More...
 
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. More...
 
void LTC24XX_SPI_16bit_command_32bit_data (uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
 Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result. More...
 
void LTC24XX_SPI_2ch_ping_pong_32bit_data (uint8_t cs, uint8_t *adc_channel, int32_t *code)
 Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter and returning the 32 bit result with the channel bit cleared so the data format matches the rest of the family. More...
 
void LTC24XX_SPI_24bit_data (uint8_t cs, int32_t *adc_code)
 Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result. More...
 
void LTC24XX_SPI_8bit_command_24bit_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 24 bit output word. More...
 
void LTC24XX_SPI_16bit_command_24bit_data (uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
 Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 24 bit output word. More...
 
void LTC24XX_SPI_2ch_ping_pong_24bit_data (uint8_t cs, uint8_t *adc_channel, int32_t *code)
 Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter and returning the 24 bit result with the channel bit cleared so the data format matches the rest of the family. More...
 
int8_t LTC24XX_I2C_8bit_command_24bit_data (uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t eoc_timeout)
 Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 24 bit result. More...
 
int8_t LTC24XX_I2C_32bit_data (uint8_t i2c_address, int32_t *adc_code, uint16_t eoc_timeout)
 Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result. More...
 
int8_t LTC24XX_I2C_8bit_command_32bit_data (uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t eoc_timeout)
 Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result. More...
 
int8_t LTC24XX_I2C_16bit_command_32bit_data (uint8_t i2c_address, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code, uint16_t eoc_timeout)
 Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result. More...
 
float LTC24XX_SE_code_to_voltage (int32_t adc_code, float vref)
 Calculates the voltage corresponding to an ADC code, given the reference voltage. More...
 
float LTC24XX_diff_code_to_voltage (int32_t adc_code, float vref)
 Calculates the voltage corresponding to an ADC code, given the reference voltage. More...
 
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 ADC offset code (zero code that is subtracted from adc_code). More...
 
void LTC24XX_calibrate_voltage (int32_t zero_code, int32_t fs_code, float zero_voltage, float fs_voltage, float *LTC24XX_lsb, int32_t *LTC24XX_offset_code)
 Calculate the lsb weight and offset code given a full-scale code and a measured zero-code. More...
 

Function Documentation

◆ LTC24XX_calibrate_voltage()

void LTC24XX_calibrate_voltage ( int32_t  zero_code,
int32_t  fs_code,
float  zero_voltage,
float  fs_voltage,
float *  LTC24XX_lsb,
int32_t *  LTC24XX_offset_code 
)

Calculate the lsb weight and offset code given a full-scale code and a measured zero-code.

Returns
Void
Parameters
zero_codeMeasured code with the inputs shorted to ground
fs_codeMeasured code at nearly full-scale
zero_voltageMeasured zero voltage
fs_voltageVoltage measured at input (with voltmeter) when fs_code was read from ADC
LTC24XX_lsbOverwritten with lsb weight (in volts)
LTC24XX_offset_codeOverwritten with offset code (zero code)

Definition at line 427 of file LTC24XX_general.cpp.

◆ LTC24XX_diff_code_to_calibrated_voltage()

float LTC24XX_diff_code_to_calibrated_voltage ( int32_t  adc_code,
float  LTC24XX_lsb,
int32_t  LTC24XX_offset_code 
)

Calculates the voltage corresponding to an ADC code, given lsb weight (in volts) and the calibrated ADC offset code (zero code that is subtracted from adc_code).

Applies to differential input, SPI interface parts.

Returns
Returns voltage calculated from ADC code.
Parameters
adc_codeCode read from ADC
LTC2449_lsbLSB weight (in volts)
LTC2449_offset_codeThe calibrated offset code (This is the ADC code zero code that will be subtracted from adc_code)

Definition at line 409 of file LTC24XX_general.cpp.

◆ LTC24XX_diff_code_to_voltage()

float LTC24XX_diff_code_to_voltage ( int32_t  adc_code,
float  vref 
)

Calculates the voltage corresponding to an ADC code, given the reference voltage.

Applies to differential input parts (LTC2410 type input)

Returns
Returns voltage calculated from ADC code.
Parameters
adc_codeCode read from ADC
vrefReference voltage

Definition at line 389 of file LTC24XX_general.cpp.

◆ LTC24XX_EOC_timeout()

int8_t LTC24XX_EOC_timeout ( uint8_t  cs,
uint16_t  miso_timeout 
)

Checks for EOC with a specified timeout.

Applies to all SPI interface delta sigma ADCs that have SINC4 rejection, does NOT apply to LTC2450/60/70 family.

Returns
Returns 0=successful, 1=unsuccessful (exceeded timeout)
Parameters
csChip Select pin
miso_timeoutTimeout (in milliseconds)

Definition at line 82 of file LTC24XX_general.cpp.

◆ LTC24XX_I2C_16bit_command_32bit_data()

int8_t LTC24XX_I2C_16bit_command_32bit_data ( uint8_t  i2c_address,
uint8_t  adc_command_high,
uint8_t  adc_command_low,
int32_t *  adc_code,
uint16_t  eoc_timeout 
)

Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of device
adc_command_highFirst command byte written to LTC24XX
adc_command_lowSecond command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX
eoc_timeoutTimeout (in milliseconds)

Definition at line 350 of file LTC24XX_general.cpp.

◆ LTC24XX_I2C_32bit_data()

int8_t LTC24XX_I2C_32bit_data ( uint8_t  i2c_address,
int32_t *  adc_code,
uint16_t  eoc_timeout 
)

Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.

Data is formatted to match the SPI devices, with the MSB in the bit 28 position.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of device
adc_code4 byte conversion code read from LTC24XX
eoc_timeoutTimeout (in milliseconds)

Definition at line 298 of file LTC24XX_general.cpp.

◆ LTC24XX_I2C_8bit_command_24bit_data()

int8_t LTC24XX_I2C_8bit_command_24bit_data ( uint8_t  i2c_address,
uint8_t  adc_command,
int32_t *  adc_code,
uint16_t  eoc_timeout 
)

Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 24 bit result.

Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of device
adc_command1 byte command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX
eoc_timeoutTimeout (in milliseconds)

Definition at line 268 of file LTC24XX_general.cpp.

◆ LTC24XX_I2C_8bit_command_32bit_data()

int8_t LTC24XX_I2C_8bit_command_32bit_data ( uint8_t  i2c_address,
uint8_t  adc_command,
int32_t *  adc_code,
uint16_t  eoc_timeout 
)

Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
i2c_addressI2C address of device
adc_command1 byte command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX
eoc_timeoutTimeout (in milliseconds)

Definition at line 326 of file LTC24XX_general.cpp.

◆ LTC24XX_SE_code_to_voltage()

float LTC24XX_SE_code_to_voltage ( int32_t  adc_code,
float  vref 
)

Calculates the voltage corresponding to an ADC code, given the reference voltage.

Applies to Single-Ended input parts (LTC2400-type input)

Returns
Returns voltage calculated from ADC code.
Parameters
adc_codeCode read from ADC
vrefReference voltage

Definition at line 375 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_16bit_command_24bit_data()

void LTC24XX_SPI_16bit_command_24bit_data ( uint8_t  cs,
uint8_t  adc_command_high,
uint8_t  adc_command_low,
int32_t *  adc_code 
)

Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 24 bit output word.

Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.

Returns
void
Parameters
csChip Select pin
adc_command_highFirst command byte written to LTC24XX
adc_command_lowSecond command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX

Definition at line 216 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_16bit_command_32bit_data()

void LTC24XX_SPI_16bit_command_32bit_data ( uint8_t  cs,
uint8_t  adc_command_high,
uint8_t  adc_command_low,
int32_t *  adc_code 
)

Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.

Returns
void
Parameters
csChip Select pin
adc_command_highFirst command byte written to LTC24XX
adc_command_lowSecond command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX

Definition at line 136 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_24bit_data()

void LTC24XX_SPI_24bit_data ( uint8_t  cs,
int32_t *  adc_code 
)

Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.

Returns
void
Parameters
csChip Select pin
adc_code4 byte conversion code read from LTC24XX

Definition at line 176 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_2ch_ping_pong_24bit_data()

void LTC24XX_SPI_2ch_ping_pong_24bit_data ( uint8_t  cs,
uint8_t *  adc_channel,
int32_t *  code 
)

Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter and returning the 24 bit result with the channel bit cleared so the data format matches the rest of the family.

Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter and returning the 32 bit result with the channel bit cleared so the data format matches the rest of the family.

Returns
void
Parameters
csChip Select pin
adc_channelReturns channel number read.
code4 byte conversion code read from LTC24XX

Definition at line 239 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_2ch_ping_pong_32bit_data()

void LTC24XX_SPI_2ch_ping_pong_32bit_data ( uint8_t  cs,
uint8_t *  adc_channel,
int32_t *  code 
)

Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter and returning the 32 bit result with the channel bit cleared so the data format matches the rest of the family.

Returns
void
Parameters
csChip Select pin
adc_channelReturns channel number read.
code4 byte conversion code read from LTC24XX

Definition at line 155 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_32bit_data()

void LTC24XX_SPI_32bit_data ( uint8_t  cs,
int32_t *  adc_code 
)

Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.

Returns
void
Parameters
csChip Select pin
adc_code4 byte conversion code read from LTC24XX

Definition at line 103 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_8bit_command_24bit_data()

void LTC24XX_SPI_8bit_command_24bit_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 24 bit output word.

Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.

Returns
void
Parameters
csChip Select pin
adc_command1 byte command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX

Definition at line 195 of file LTC24XX_general.cpp.

◆ LTC24XX_SPI_8bit_command_32bit_data()

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.

Returns
void
Parameters
csChip Select pin
adc_command1 byte command written to LTC24XX
adc_code4 byte conversion code read from LTC24XX

Definition at line 118 of file LTC24XX_general.cpp.