D5b_module

class spirack.D5b_module(spi_rack, module, reset_voltages=True)

SPI Rack interface code for the D5b module. An 8 channel 18-bit DAC module with integrated ARM Cortex M4 microcontroller. The DACs used in this module are identical to the D5a module, with the addition of a microcontroller. This microcontroller handles all the communication with the DACs. This allows for exactly timed DAC updates: based on triggers, timers etc.

This class does the low level interfacing with the D5b module. When creating an instance it requires a SPI_rack class passed as a parameter.

Parameters:

  • spi_rack (SPI_rack) - SPI_rack class object via which the communication runs.
  • module (int) - module number set in hardware.
  • 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.

Methods

set_clock_source(source)

Set the microcontroller clock source to either a local (inside the module) clock or a clock from the backplane. This allows for multiple modules to run of the same clock. The module expects a 10 MHz clock, either sine wave or square.

Parameters:

  • source (string) - either ‘internal’ or ‘external’. Clock source for the microcontroller

get_clock_source()

Gets the set clock source from the microcontroller.

Returns - the set clock source: ‘internal’ or ‘external’ (string)


set_DAC_span(DAC, span, update=True)

Changes the span of the selected DAC. If update is True the span gets updated immediately. If False, it will update with the next span or value setting.

Parameters:

  • DAC (int: 0-7) - DAC inside the module of which to set the span.
  • span (string) - the span to be set (4V_uni, 8V_uni, 4V_bi, 8V_bi, 2V_bi).
  • update (bool) - if True updates the span immediately, if False updates with the next span/value update.

get_DAC_span(DAC)

Gets the software span of the selected DAC.

Parameters:

  • DAC (int: 0-7) - DAC of which to read the span

Returns - Set span of the DAC (string)


set_DAC_mode(DAC, mode)

Sets the mode of the selected DAC. The DACs can be set to two modes: ‘DC’ or ‘toggle’. In DC mode the output of the DAC gets set statically and remains that way until the next update. In toggle mode the DAC gets toggled between two values. Multiple DACs can be set to toggle. Each DAC can have its own toggle values, but they always share the same toggle amount and toggle time.

Parameters:

  • DAC (int: 0-7) - DAC of which to set the mode
  • mode (string) - mode of the DAC, either ‘DC’ or ‘toggle’

get_DAC_mode(DAC)

Gets the mode of the selected DAC.

Parameters:

  • DAC (int: 0-7) - DAC of which to read the mode

Returns - Set mode of the DAC (string)


set_DAC_voltage(self, DAC, voltage, update=True):

Calculates and sets the DAC bit value using the set span and updates the DAC. The DAC value is the value which is output at all times, both in ‘DC’ and in ‘toggle’ mode. It will set the voltage to the max/min of the current span, if the input voltage exceeds these limits. Unless the user takes care of using a voltage which is an integere multiple of the DAC step size, the actual voltage will differ slightly from the requested one. For exact values, use the get_stepsize() function and use only integer multiples.

Parameters:

  • DAC (int: 0-7) - DAC of which to set the voltage
  • voltage (float) - DAC output voltage
  • update (bool) - if True updates the output immediately, if False updates with the next span/value update

set_DAC_pos_toggle_voltage(DAC, voltage)

Calculates and sets the DAC bit value for the positive toggle voltage. All the DACs which are set to ‘toggle’ mode will toggle between positive and negative toggle voltages. The DACs can have individually set positive, negative and normal voltages.

Parameters:

  • DAC (int: 0-7) - DAC of which to set the voltage
  • voltage (float) - Positive toggle voltage

set_DAC_neg_toggle_voltage(DAC, voltage)

Calculates and sets the DAC bit value for the negative toggle voltage. All the DACs which are set to ‘toggle’ mode will toggle between positive and negative toggle voltages. The DACs can have individually set positive, negative and normal voltages.

Parameters:

  • DAC (int: 0-7) - DAC of which to set the voltage
  • voltage (float) - Negative toggle voltage

get_DAC_voltages(DAC)

Returns the currently set voltage, negative toggle voltage and positive toggle voltage of the given DAC.

Parameters:

  • DAC (int: 0-7) - DAC of which to read the voltages

Returns - List with voltages: [voltage, negative_toggle_voltage, positive_toggle_voltage]


set_trigger_holdoff_time(holdoff_time)

Sets the time the system waits after the trigger for outputting the toggling DACs. The mimimum time is 30 us, and the resolution is 100ns.

Parameters:

  • holdoff_time (float) - amount of time (in seconds) to wait after trigger (minimum 30 us)

get_trigger_holdoff_time()

Gets the set trigger holdoff time. See set_trigger_holdoff_time for details.

Returns - the set holdoff_time in seconds.


set_toggle_time(toggle_time)

Sets the toggle time for all the DACs set to ‘toggle’ mode. The value set is the time how long the DAC stays high or low. It is a multiple of of the 100 ns clock used for the timing, this means sub 100 ns resolution is not possible.

Parameters:

  • toggle_time (float) - toggle time in seconds (minimum 5μs)

get_toggle_time()

Gets the toggle time for all the DACs set to ‘toggle’ mode. See set_toggle_time for more details.

Returns - toggle time in seconds (float)


set_toggle_amount(amount)

Sets the amount of times the DACs (set to ‘toggle mode’) have to toggle. Generates a trigger on the backplane everytime the toggle happens. It has to be an even number of toggles.

Parameters:

  • amount (int) - the amount of times the DACs have to toggle (even number)

get_toggle_amount()

Gets the toggle amount.

Returns - the set toggle amount (int)


cancel_run()

When this function is called, it cancels the current run of the module. This can be useful if the toggle amount and/or the toggle time are set wrong or too long.


get_stepsize(span)

Returns the smallest voltage step for a given span

Parameters:

  • span (string) - the span calculate the stepsize of (4V_uni, 8V_uni, 4V_bi, 8V_bi, 2V_bi)

Returns - Smallest voltage step possible with span (float)


get_firmware_version()

Gets the firmware version of the D5b module.

Returns - firmware version of the S5b module (int)


is_running()

This function return true if the module is running a measurement, should be used to check if the module is finished.

Returns - True if the module is running a measurement (bool)


software_trigger()

This allows the user to trigger the S5b via software, not using the trigger lines on the backplane of the SPI rack.