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:
range_4V_bi
. If a voltage jump would occur, then ramp to zero in steps of 10 mV. Defaults to True.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:
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:
get_DAC_span(DAC)
Gets the software span of the selected DAC.
Parameters:
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:
get_DAC_mode(DAC)
Gets the mode of the selected DAC.
Parameters:
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:
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:
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:
get_DAC_voltages(DAC)
Returns the currently set voltage, negative toggle voltage and positive toggle voltage of the given DAC.
Parameters:
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:
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:
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:
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:
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.