In addition to the software interface described on this page, some S5k notebooks have been shared by the user community. They are available here and here. You are welcome to view them though they have not been fully verified by the developers.
class spirack.S5k_module(spi_rack, module)
SPI Rack interface code for the S5k module: a low-cost 8-16-channel AWG.
Parameters:
set_waveform_mode(DAC, waveform)
Set the given DAC (output channel) to a selected waveform mode. Allowed values for the waveform are 'DC', 'sawtooth', 'noise' or 'AWG', as described in the module page.
Parameters:
get_waveform_mode(DAC)
Returns the waveform mode set for the given DAC.
Parameters:
set_DAC_scale(DAC, Vmax, Vmin)
Sets high and low voltage limits for the given DAC. The high limit given must be positive and the low limit given must be negative, and both must be in the ±2.875V range.
It may seem beneficial for the user to narrow the scale down to the requested output range in order to achieve better resolution. However, the function 'set_DAC_scale' represents the scale achieveable by the given hardware and not the scale of an arbitrary output waveform.
The S5k settings match by default to +2.875V or -2.875V, which is the scale of the default S5k hardware. The users are expected to use the 'set_DAC_scale' function rarely and only for S5k with a non-default build. Using this funtion incorrectly will result in wrong output levels.
Parameters:
set_DC_value(DAC, value)
Sets the DC level for a given DAC. Caution - the function 'set_DAC_scale' must preceed this function or results would be erronous.
This function is primarily intended for DACs set to the 'DC' mode. It can also be used for DACs set to non-DC mode, but the DC level would only show when the DAC is not running its specified waveform. The level must be within the 'Vmax' to 'Vmin' limits.
The resolution of the DC level is the S5k range (determined as Vman - Vmin) divided by 4096. For example, at the specified range of ±2.875V the resolutuion is roughly 1.4mV. This means that the actual level set in the S5k may be slightly rounded from the value given by the user to align with the S5k resolution. The actual level can be received through the 'get_DC_value' function.
Parameters:
get_DC_value(DAC)
Returns the DC value for the given DAC. This is the actual value set in the S5k module, aligned with the S5k resolution, which may be slightly rounded from the value given by the user.
Parameters:
Returns - the DC level set for the DAC
set_sawtooth_parameters(DAC, sawtooth_type, stepsize)
Sets the sawtooth parameters for a given DAC. It can only be used on DACs set to 'sawtooth' mode.
The type can be either 'ramp_up', 'ramp_down', 'triangle', or 'no_wave'. The stepsize controls the sawtooth period. Nominally the number of steps for any sawtooth waveform is fixed at 16384 (or 2^14). However the duration of a step can be controlled. The fastest sawtooth would update steps at the full (highest) clock frequency. A slower sawtooth would update steps at a divided clock frequency. The division ratio is the stepsize parameter, taking values between 1 to 63.
Parameters:
upload_waveform(DAC, waveform, start_addr, set_pattern_length=True)
Uploads a user-defined waveform to the module memory and assigns it to a DAC.
Parameters:
set_RAM_address(DAC, start_pos, stop_pos)
Sets the start address and stop address in the AWG memory for the selected DAC. This function is only relevant for DACs in AWG mode. When the DAC is running it will output data from this address range.
Parameters:
set_pattern_length_DAC(DAC, length)
Sets the pattern length (a.k.a. pattern period) for a DAC in the 'waveform' mode.
In most practical cases the pattern length is chosen to include the waveform length alone. In less common cases the pattern length may be longer than the waveform length to include additional pre- or post-waveform delays but these options are not offered by default. If the pattern length is shorter than the waveform length the waveform would not be output in full. It is up to the user to set the appropriate pattern length. In all cases the pattern length is limited to 65535 (or 2^16 - 1).
The pattern length is shared across groups of four consecutive DACs (outputs 1,2,3,4; outputs 5,6,7,8; etc). An update to any DAC in the group would affect all four DACs.
Parameters:
set_pattern_length_trigger(length, S5k_version = 1.0)
Sets the initial delay from trigger to output. This applies to all 16 outputs of the module.
Parameters:
set_clock_source(source)
Sets the clock source for the S5k to either an 'external' reference clock or an 'internal' 200MHz clock.
Parameters:
sync_clock()
Synchs the different clocks used in the S5k. Necessary after any clock change
set_clock_division(DAC, divisor)
Sets a division of the clock to a lower frequency. Allowed dividers are 1 and any even number between 2 and 510. This setting is shared across groups of four consecutive DACs (outputs 1,2,3,4; outputs 5,6,7,8; etc).
Parameters:
set_digital_gain(DAC, gain)
Sets a gain for the given DAC. This is applied arithmetically and implemented in the digital domain. During calculation the user-given value may be rounded down to align with the S5k resolution, typically up to 0.00006 (~60ppm) of gain rounding. The allowed digital gains are between -1.99 and 2.00. A value exceeding these will be clipped to the nearest limit.
Parameters:
set_digital_offset(DAC, offset)
Sets an offset for the given DAC. This is applied arithmetically and implemented in the digital domain. During calculation the user-given value may be rounded down to align with the S5k resolution, typically up to ~1.4mV of offset rounding. The allowed digital offsets are between -2.857V and 2.857V. A value exceeding these will be clipped to the nearest limit.
Parameters:
run_module(run)
Instructs all DAC outputs to produce the configured waveform and start outputting a trigger. This can also be done by an external trigger-in on the front of the module.
Parameters:
get_S5k_run_status()
Returns the present status of the S5k, whether running or idle.
Parameters:
Returns - the present status of the S5k (bool)
reset_DACs()
Clears the RAM of the AWG chip and resets registers to 0 for all DACs