| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions
LTC24XX_general.cpp File Reference
Analog-to-Digital Converters (ADC) » LTC24XX: All no-latency delta sigma ADCs with SINC4 rejection

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_code | Measured code with the inputs shorted to ground
  fs_code | Measured code at nearly full-scale
  zero_voltage | Measured zero voltage
  fs_voltage | Voltage measured at input (with voltmeter) when fs_code was read from ADC
  LTC24XX_lsb | Overwritten with lsb weight (in volts)
  LTC24XX_offset_code | Overwritten 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_code | Code read from ADC
  LTC2449_lsb | LSB weight (in volts)
  LTC2449_offset_code | The 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_code | Code read from ADC
  vref | Reference 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

  cs | Chip Select pin
  miso_timeout | Timeout (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_address | I2C address of device
  adc_command_high | First command byte written to LTC24XX
  adc_command_low | Second command written to LTC24XX
  adc_code | 4 byte conversion code read from LTC24XX
  eoc_timeout | Timeout (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_address | I2C address of device
  adc_code | 4 byte conversion code read from LTC24XX
  eoc_timeout | Timeout (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_address | I2C address of device
  adc_command | 1 byte command written to LTC24XX
  adc_code | 4 byte conversion code read from LTC24XX
  eoc_timeout | Timeout (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_address | I2C address of device
  adc_command | 1 byte command written to LTC24XX
  adc_code | 4 byte conversion code read from LTC24XX
  eoc_timeout | Timeout (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_code | Code read from ADC
  vref | Reference 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

  cs | Chip Select pin
  adc_command_high | First command byte written to LTC24XX
  adc_command_low | Second command written to LTC24XX
  adc_code | 4 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

  cs | Chip Select pin
  adc_command_high | First command byte written to LTC24XX
  adc_command_low | Second command written to LTC24XX
  adc_code | 4 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

  cs | Chip Select pin
  adc_code | 4 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

  cs | Chip Select pin
  adc_channel | Returns channel number read.
  code | 4 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

  cs | Chip Select pin
  adc_channel | Returns channel number read.
  code | 4 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

  cs | Chip Select pin
  adc_code | 4 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

  cs | Chip Select pin
  adc_command | 1 byte command written to LTC24XX
  adc_code | 4 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

  cs | Chip Select pin
  adc_command | 1 byte command written to LTC24XX
  adc_code | 4 byte conversion code read from LTC24XX

Definition at line 118 of file LTC24XX_general.cpp.