D4_module


class spirack.D4_module(spi_rack, module)

D4 module interface class. This class does the low level interfacing with the D4 module. When creating an instance, it requires a SPI_rack class passed as a parameter. At initialization the ADC filters will be set to ‘sinc3’ at 16.67 SPS.

The module contains two independent 24-bit analog to digital converters. They can be individually configured and triggered. The filter settings determine the data rate and resolution. For an overview of settings, see the D4 module page.

Parameters:

  • spi_rack (SPI_rack) - SPI_rack class object via which the communication runs
  • module (int) - module number set in hardware

Methods

set_filter(adc, filter_type, filter_setting)

The two filter parameters determine the filter response (cutoff frequency), the 50 Hz rejection and the resolution. See the filter table on the website to determine which setting is correct for your application.

Parameters:

  • ADC (int: 0-1) - ADC inside the module which needs to be set
  • filter_type (string) - set to sinc3 or sinc5
  • filter_setting (int: 0-20) - the desired filter setting

single_conversion(adc)

Performs a conversion on the given ADC. It will both trigger the ADC and wait for the result. Because of this it will block all other operations.

Parameters:

  • ADC (int: 0-1) - ADC inside the module which needs to be set

start_conversion(adc)

Triggers a conversion on the given ADC. Does not wait for the result. This should be used if multiple devices/adcs need triggering. After the conversion is done it will immediately continue doing conversions and updating the output.

Parameters:

  • ADC (int: 0-1) - ADC inside the module which needs to be set

get_result(adc)

Returns the result from a triggered conversion. The function will wait until the result is present, therefore it will block all other operations.

It will return the last conversion result. If the time between the trigger and getting the result is too long, the result will be of a second/third conversion. The ADC keeps converting and updating the data output.

Parameters:

  • ADC (int: 0-1) - ADC inside the module which needs to be set

offset_calibration(adc)

Calibrates the offset of the given ADC input. To run this routine, put a short or 50 Ohm short on the input of the given ADC.

Parameters:

  • ADC (int: 0-1) - ADC inside the module which needs to be set

gain_calibration(adc)

Calibrates the gain of the given ADC input. To run this routine, put 4V on the input of the given ADC using a D5a.

Parameters:

  • ADC (int: 0-1) - ADC inside the module which needs to be set

Attributes

Attribute Info
module the module number set by the user (must coincide with hardware)
filter_setting current filter setting
filter_type currently set filter_type: either sinc3 or sinc5