D5a_module


class spirack.D5a_module(spi_rack, module, reset_voltages=True, num_dacs=16)

D5a module interface class. This class does the low level interfacing with the D5a module. When creating an instance it requires a SPI_rack class passed as a parameter. The analog span of the DAC module can be set via software for each of the 16 DACs individually.

Setting the voltage can happen via the set_voltage function. Other ways are the change_value_update function, which immediately updates the output of the DAC, or via the change_value function. This function writes the new value to the DAC but does not update the output until the update function is ran.

Parameters:

  • spi_rack (SPI_rack) - SPI_rack class object via which the communication runs
  • module (int) - module number set on the harware
  • reset_voltages (bool) - if True, then reset all voltages to zero and change the span to range_4V_bi. If a voltage jump would occur, then ramp to zero in steps of 10 mV. Defaults to True
  • num_dacs (int) - number of DAC channels available. Defaults to 16

Methods

set_voltage(DAC, voltage)

Sets the DAC output voltage and updates the DAC output. The function calculates the DAC value for the given voltage at the currently set DAC span. It will set to max/min when the input voltage exceeds the span and prints out a warning to the user. There will always be a difference between the wanted voltage and the output voltage as long as it is not a multiple of the step size. The calculated value is floored, not rounded.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the voltage needs to be changed
  • voltage (float) - new DAC voltage

get_stepsize(DAC)

Returns the smallest voltage step for a given DAC. The function calculates and returns the smallest voltage step of the DAC for the set span. Voltage steps smaller than this will not change the DAC value. It is recommended to only step the DAC in multiples of this value, as otherwise steps might not behave as expected.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the stepsize is calculated

Returns - smallest voltage step possible with the DAC in its current setting (float)


get_settings(DAC)

Reads current DAC settings. This function reads back the DAC registers of the given DAC for both the code and the span. It calculates the voltage set with the read out span.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the settings will be read

Returns - list with voltage (float) and span (int): [voltages, span]


change_span_update(DAC, span)

Changes the span of the DAC and immediately updates the output of the DAC. Use the constants listed below as argument for the span.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the span needs to be changed
  • span (int) - values for the span as mentioned in the datasheet, use constants as defined below

change_span(DAC, span)

Changes the span of the DAC without updating the output of the DAC. Only updates when update(DAC) is called. Use the constants listed below as argument for the span.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the span needs to be changed
  • span (int) - values for the span as mentioned in the datasheet, use constants as defined below

change_value_update(DAC, value)

Changes the DAC value, where value is an 18-bit integer. Calling this function changes the value of the DAC and immediately updates the output.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the value needs to be changed
  • value (18-bit unsigned int) - new DAC value

change_value(DAC, value)

Changes the DAC value, where value is an 18-bit integer. Calling this function changes the value of the DAC, but does not update the output until the update(DAC) function is called.

Parameters:

  • DAC (int: 0-15) - DAC inside the module of which the value needs to be changed
  • value (18-bit unsigned int) - new DAC value

update(DAC)

Updates the output of the DAC to the set range or output value. This is necessary after using change_value or change_span. These functions write into a double buffer inside the chip, when this function is called it will be put into the output buffer.

Parameters:

  • DAC (int: 0-15) - DAC inside the module which needs to be updated

Attributes

Attribute Info
module the module number set by the user (must coincide with hardware)
span a list of values of the span for each DAC in the module
voltages a list of DAC voltage settings last written to the DACs

Constants

Constants
range_4V_uni
range_4V_bi
range_8V_uni
range_8V_bi
range_2V_bi