class spirack.S4g_module(spi_rack, module, reset_currents=True)
S4g module interface class. This class does the low level interfacing with the S4g 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 4 DACs/current sources.
Setting the current can happen via the set_current
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:
range_50mA_bi
set_current(DAC, current)
Sets the output current and updates the DAC output. The function calculates the DAC value for given current at the set span of the DAC. It will set to max/min when input current exceeds span and prints out a warning to the user. There will always be a difference between the set current and the desired output current, as long as not a multiple of the step size is used. The calculated value is floored, not rounded.
Parameters:
get_stepsize(DAC)
Returns the smallest current step for a given DAC. The function calculates and returns the smallest current step of the DAC for the set span. Current steps smaller than this will not change the DAC value. Recommended to only step the DAC in multiples of this value, as otherwise steps might not behave as expected.
Parameters:
Returns - smallest current 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 current set with the read out span.
Parameters:
Returns - list with current (float) and span (int): [current, 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:
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:
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:
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:
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:
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 |
currents |
a list of DAC current settings last written to the DACs |
Constants |
---|
range_50mA_uni |
range_50mA_bi |
range_25mA_bi |