Skip to content
AdinAck edited this page Jul 26, 2020 · 14 revisions

Quick Navigation

Initialization


Single ADC Methods


Multi ADC Methods


Initialization

setup(spi, start_pin, reset_pin, freq=2000000)

Parameters:

  • SPI bus (busio object)
  • start pin (board pin object)
  • reset pin (board pin object)
  • SPI bus frequency (int)

Returns:

None

Description:

This method sets up the ADS1248 bus for all ADCs.


__init__(cs_pin, drdy_pin, vref=2.048)

Parameters:

  • Chip select pin (board pin object)
  • DRDY pin (board pin object)
  • Voltage reference to be used in calculations (float or int)

Returns:

ADS1248 object

Description:

This is the initialization method for an ADS1248 object, when a variable is set equal to this, the variable becomes an ADS1248 object.


Single ADC Methods

wakeup(adc)

Parameters:

  • ADC (ADS1248 object)

Returns:

None

Description:

The wakeup method will send the wakeup command to the ADC.

The wakeup command enables the ADC and allows for other commands to be received.


sleep(adc)

Parameters:

  • ADC (ADS1248 object)

Returns:

None

Description:

The sleep method will send the sleep command to the ADC.

The sleep command puts the ADC in a low power state, meaning it will not respond to most commands.

Note that the sleep command will not disable the internal voltage reference.


rst(adc)

Parameters:

  • ADC (ADS1248 object)

Returns:

None

Description:

The rst method will send the reset command to the ADC.

The reset command will reset the registers to defaults and reset the digital filter.

The reset command will not reset the serial interface.


rreg(adc, register, count)

Parameters:

  • ADC (ADS1248 object)
  • Register address (int or hex)
  • Number of registers to read (int)

Returns:

Array of register values as integers.

Description:

The rreg method will send the rreg command to the ADC, then receive the register values and return them as an array of integers.


wreg(adc, register, data)

Parameters:

  • ADC (ADS1248 object)
  • Register address (int or hex)
  • Array of data to be written (List of ints or hex)

Returns:

None

Description:

The wreg method will send the wreg command to the ADC along with the provided list of register values.


selfOffset(adc)

Parameters:

  • ADC (ADS1248 object)

Returns:

None

Description:

The selfOffset method will send the selfocal command to the ADC.

The selfocal command initiates an internal offset calibration of the ADC.

The OFC register will store the value that will be subtracted from all future conversion results.


fetch(adc, ref, inputs, raw=False)

Parameters:

  • ADC (ADS1248 object)
  • AIN pin to be referenced to (int)
  • Inputs to be measured (List of ints)
  • Return calculated voltage or binary (Boolean)

Returns:

Differential voltages of inputs and ref (List of floats or binary)

Description:

The fetch method will configure the ADC to measure each input in the inputs list in relation to the ref pin and then append the result to an array that will be returned after all inputs have been measured.


Multi ADC Methods

wakeupAll()

Parameters:

None

Returns:

None

Description:

The wakeupAll method will send the wakeup command to all ADCs.

The wakeup command enables the ADC and allows for other commands to be received.


sleepAll()

Parameters:

None

Returns:

None

Description:

The sleepAll method will send the sleep command to all ADCs.

The sleep command puts the ADC in a low power state, meaning it will not respond to most commands.

Note that the sleep command will not disable the internal voltage reference.


rstAll()

Parameters:

None

Returns:

None

Description:

The rstAll method will send the reset command to all ADCs.

The reset command will reset the registers to defaults and reset the digital filter.

The reset command will not reset the serial interface.


rregAll(register, count)

Parameters:

  • Register address (int or hex)
  • Number of registers to read (int)

Returns:

Array of arrays of register values as integers.

Description:

The rregAll method will send the rreg command to all ADCs, then receive the register values and return them as an array of arrays containing register values as integers.


wregAll(register, data)

Parameters:

  • Register address (int or hex)
  • Array of data to be written (List of ints or hex)

Returns:

None

Description:

The wregAll method will send the wreg command to all ADCs along with the provided list of register values.


selfOffsetAll()

Parameters:

None

Returns:

None

Description:

The selfOffsetAll method will send the selfocal command to all ADCs.

The selfocal command initiates an internal offset calibration of the ADC.

The OFC register will store the value that will be subtracted from all future conversion results.


fetchAll(ref, inputs, raw=False)

Parameters:

  • AIN pin to be referenced to (int)
  • Inputs to be measured (List of ints)
  • Return calculated voltage or binary (Boolean)

Returns:

Differential voltages of inputs and ref (List of floats or binary)

Description:

The fetchAll method will configure all ADCs to measure each input in the inputs list in relation to the ref pin and then append the result to an array that will be returned after all inputs have been measured.