herosdevices.hardware.texas_instruments.ads1256 - Heros Devices 0.6.0 documentation

Skip to content
Back to top
View this page

# herosdevices.hardware.texas_instruments.ads1256

Drivers for the ADS1256 24-Bit, 30kSPS, 8-Channel ADC.

## Module Contents

class herosdevices.hardware.texas_instruments.ads1256.ADS1256_CHANNEL

  Bases: `enum.Enum`

  Multiplexer channel.

  AIN0 = 0
  AIN1 = 1
  AIN2 = 2
  AIN3 = 3
  AIN4 = 4
  AIN5 = 5
  AIN6 = 6
  AIN7 = 7
  AINCOM = 8

class herosdevices.hardware.texas_instruments.ads1256.ADS1256_GAIN

  Bases: `enum.Enum`

  Gain of the programmable gain amplifier.

  For voltage ranges for each gain settings refer to ADS1256 datasheet Table 8.

  GAIN_1 = 0
  GAIN_2 = 1
  GAIN_4 = 2
  GAIN_8 = 3
  GAIN_16 = 4
  GAIN_32 = 5
  GAIN_64 = 6

class herosdevices.hardware.texas_instruments.ads1256.ADS1256_DRATE

  Bases: `enum.Enum`

  Possible A/D Datarates.

  Refer to table: DRATE: A/D Data Rate (Address 03h) in the datasheet for more information.

  DRATE_30000SPS = 240
  DRATE_15000SPS = 224
  DRATE_7500SPS = 208
  DRATE_3750SPS = 192
  DRATE_2000SPS = 176
  DRATE_1000SPS = 161
  DRATE_500SPS = 146
  DRATE_100SPS = 130
  DRATE_60SPS = 114
  DRATE_50SPS = 99
  DRATE_30SPS = 83
  DRATE_25SPS = 67
  DRATE_15SPS = 51
  DRATE_10SPS = 32
  DRATE_5SPS = 19
  DRATE_2d5SPS = 3

class herosdevices.hardware.texas_instruments.ads1256.ADS1256_REG

  Bases: `enum.Enum`

  Registers of the ADS1256.

  STATUS = 0
  MUX = 1
  ADCON = 2
  DRATE = 3
  IO = 4
  OFC0 = 5
  OFC1 = 6
  OFC2 = 7
  FSC0 = 8
  FSC1 = 9
  FSC2 = 10

class herosdevices.hardware.texas_instruments.ads1256.ADS1256_CMD

  Bases: `enum.Enum`

  Command definitions.

  Refer to table 24 in the datasheet for details.

  WAKEUP = 0
  RDATA = 1
  RDATAC = 3
  SDATAC = 15
  RREG = 16
  WREG = 80
  SELFCAL = 240
  SELFOCAL = 241
  SELFGCAL = 242
  SYSOCAL = 243
  SYSGCAL = 244
  SYNC = 252
  STANDBY = 253
  RESET = 254

herosdevices.hardware.texas_instruments.ads1256.delay_us(delay: int) → None

  Delay execution by delay microseconds (Uses sleep function).

  Parameters:

    delay – delay in microseconds.

class herosdevices.hardware.texas_instruments.ads1256.ADS1256(spi_bus: int = 0, spi_device: int = 0, cs_pin: int = 22, rst_pin: int = 18, drdy_pin: int = 17, spi=None, gpio_device: str = '/dev/gpiochip0', default_gain: ADS1256_GAIN = ADS1256_GAIN.GAIN_1, default_drate: ADS1256_DRATE = ADS1256_DRATE.DRATE_30000SPS)

  Interfacing the ADS1256 SPI ADC (as e.g. used on the Waveshare high-precision AD-DA board).

  reset() → None

    Reset the chip by pulsing the reset pin.

  config_adc(gain: ADS1256_GAIN, drate: ADS1256_DRATE) → None

    Configure the gain and datarate of the ADC.

  self_calibration() → None

    Run offset and gain self calibration.

  set_channel(pos_channel: ADS1256_CHANNEL, neg_channel: ADS1256_CHANNEL = ADS1256_CHANNEL.AINCOM) → None

    Set channel of the input multiplexer.

    The multiplexer performs a differential measurement between pos_channel and neg_channel. Details can be found in the datasheet under “Input Multiplexer”.

    Parameters:

      - pos_channel – Positive channel.

      - neg_channel – Negative channel. Defaults to AINCOM (non-differential measurement).

  set_scan_mode(mode)
  read_adc_data() → int

    Read ADC value from the currently active channel in bits.

  get_channel_value(pos_channel: ADS1256_CHANNEL, neg_channel: ADS1256_CHANNEL = ADS1256_CHANNEL.AINCOM) → int

    Read ADC value from the given channel in bits either single-ended or differential.

  get_all() → list[int]

    Read ADC for all channels subsequently.