# Advantest R6245/R6246 DC Voltage/Current Sources/Monitors

## Main Classes

class pymeasure.instruments.advantest.advantestR624X.AdvantestR6245(adapter, name='Advantest R6245 SourceMeter', **kwargs)

  Bases: `AdvantestR624X`

  Main instrument class for Advantest R6245 DC Voltage/Current Source/Monitor

  ch_A
    Channel:

      `SMUChannel`

  ch_B
    Channel:

      `SMUChannel`

class pymeasure.instruments.advantest.advantestR624X.AdvantestR6246(adapter, name='Advantest R6246 SourceMeter', **kwargs)

  Bases: `AdvantestR624X`

  Main instrument class for Advantest R6246 DC Voltage/Current Source/Monitor

  ch_A
    Channel:

      `SMUChannel`

  ch_B
    Channel:

      `SMUChannel`

class pymeasure.instruments.advantest.advantestR624X.AdvantestR624X(adapter, name='R624X Source meter Base Class', **kwargs)

  Bases: `SCPIUnknownMixin`, `Instrument`

  Represents the Advantest R624X series (channel A and B) SourceMeter and provides a high-level interface for interacting with the instrument.

  This is the base class for both AdvantestR6245 and AdvantestR6246 devices. It’s not necessary to instantiate this class directly instead create an instance of the AdvantestR6245 or AdvantestR6246 class as shown in the following example:

      smu = AdvantestR6246("GPIB::1")
      smu.reset()                                                     # Set default parameters
      smu.ch_A.current_source(source_range = CurrentRange.FIXED_60mA,
                              source_value = 0,                       # Source current at 0 A
                              voltage_compliance = 10)                # Voltage compliance at 10 V
      smu.ch_A.enable_source()                                        # Enables the source output
      smu.ch_A.measure_voltage()
      smu.ch_A.current_change_source = 5e-3                           # Change to 5mA
      print(smu.read_measurement())                                   # Read and print the voltage
      smu.ch_A.standby()                                              # Put channel A in standby

  write(command, **kwargs)

    Write a string command to the instrument appending write_termination.

    Parameters:

      - command – command string to be sent to the instrument

      - kwargs – Keyword arguments for the adapter.

  check_errors()

    Read all errors from the instrument.

    Returns:

      List of error entries.

  enable_source()

    Put channel A & B into the operating state (`CN`).

    Note

    When the ‘interlock control’ of the ‘SCT’ command is ‘2’ and the clock signal is ‘HI’, it will not enter the operating state.

  standby()

    Put channel A & B in standby mode (`CL`).

  clear_status_register()

    Clears the Standard Event Status Register (SESR) and related queues (excluding output queues) (`*CLS`).

  property srq_enabled

    Set a boolean that controls whether the GPIB SRQ feature is enabled, takes values of True or False (`S0/S1`).

    Type:

      bool

    The SRQ feature of the GPIB bus provides hardware handshaking between the GPIB controller card in the PC and the instrument. This allows synchronization between moving data to the PC with the state of the instrument without the need to use time delay functions.

  trigger()

    Outputs the trigger signal or the start of sweep and search measurement to both A and B channels and the trigger link (`XE`).

    Note

    - When both A channel and B channel are waiting for a trigger, both channels are triggered.

    - When either channel A or B is waiting for a trigger, only the channel that is waiting for a trigger is triggered.

    - When both A channel and B channel are waiting for sweep start, this will apply sweep start to both channels.

    - When either channel A or B is in the sweep start waiting state, only the channel in the sweep start waiting state is started.

    - When either channel A or B is waiting for a trigger and the other is waiting for a sweep start, trigger and sweep start are applied, respectively.

    - When the trigger link is ON and this is the master unit, set the *TRG signal on the trigger link bus to TRUE.

    - When the trigger link is ON and the master unit, the trigger link is activated.

  stop()

    Stops the sweep when the sweep is started by the XE command or the trigger input signal (`SP`).

  set_digital_output(values)

    Outputs a 16-bit signal from the DIGITAL OUT output terminal on the rear panel. You can set up to 9 output data (`DIOS`). If there are multiple values specified, the data is output at intervals of about 2ms and fixed as the final data.

    Parameters:

      values (int or list) – Digital out bit values

    Note

    The output of digital data to the DIGITAL OUT pin is only the bits specified by the DIOE command. Bits that are not specified will result in alarm output or unused, and no digital data will be output.

  property sweep_delay_time

    Set the sweep delay time (Ta) or generation / delay time (Ta) of the master channel and slave channel during delayed sweep operation or synchronous operation between pulse measurements (`GDLY`).

    Type:

      float

    Note

    If the sweep delay time does not meet (Ta<Tw and Ta<Td+Tit), an execution error will occur and it will not be set:

    Tw: Pulse width Td: Major delay time Tit: Integration time

  init_sequence()

    This function starts the redirection of `write()` to `store_sequence_command()` to automatically create a sequence program.

  start_sequence(repeat=1)

    This function starts the sequence program which is initiated by `init_sequence()` and ended by `end_sequence()`.

  end_sequence()

    This function ends the sequence program which is initiated by `init_sequence()`.

  sequence_wait(wait_mode, wait_value)

    Waits for program execution and is used only for sequence programs (`WAIT`).

    Parameters:

      - wait_mode (int) – Whether wait time (1) or trigger input count (2) is specified

      - wait_value (float) – Wait time or trigger input count as specified by wait_mode

    This command has the following functions:

    > - Make the execution of the next program wait for the specified time.

    > - Makes the next program execution wait until the specified number of triggers is input.

    Regardless of the wait mode, if the wait data is 0, the wait operation is not performed. When the wait mode is “2”, the following commands and signals can be used as trigger inputs:

    > - XE (XE 0, XE 1, XE 2)

    > - *TRG

    > - GET command (group execute trigger)

    > - Trigger input signal on rear panel

  start_sequence_program(start, stop, repeat)

    Starts from the program number until the stop of the sequence program (`RU`). Executes sequentially up to the program number, and repeats for the number of times of specified.

    Parameters:

      - start (int) – Number of the program to start from ranging 1 to 100

      - stop (int) – Number of the program to stop at ranging from 1 to 100

      - repeat (int) – Number of times repeated from 1 to 100

  store_sequence_command(line, command)

    Stores the program to be executed in the sequence program (`ST`). If the program already exists, it is replaced with the new sequence.

    Parameters:

      - line (int) – Line number specified of memory location

      - command (str) – Command(s) specified to be stored delimited by a semicolon (;)

  interrupt_sequence_command(action)

    Interrupts the sequence program executed by the `start_sequence_program()` command (`SQSP`).

    Parameters:

      action (`SequenceInterruptionType`) – Specifies sequence interruption setup

  property sequence_program_number

    Measure the amount of program sequences stored in the sequence memory (`LNUB?`).

  sequence_program_listing(line)

    This is a query command to know the command list stored in the program number of the sequence program memory (`LST?`).

    Parameters:

      action (int) – Specifying the memory location for reading the commands

    Returns:

      Commands stored in sequence memory

    Return type:

      str

  trigger_output_signal(trigger_output, alarm_output, scanner_output)

    Directly output the trigger output signal, alarm output signal, scanner (start/stop) output signal from GPIB (`OSIG`).

    Parameters:

      - trigger_output (int) – Number specifying type of trigger output

      - alarm_output (int) – Number specifying type of alaram output

      - scanner_output (int) – Number specifying the type of scanner output

    Trigger output:

    1. Do not output to trigger output.

    2. Output a negative pulse to the trigger output.

    Alarm output:

    1. Finish output GO, LO.HI both set to HI level. (reset)

    2. Finish output Set GO to LO level.

    3. Set home output LO to LO level.

    4. Terminate output HI to LO level.

    Scanner - (start/stop) output:

    1. Set the scanner scoot output to HI level. Output a negative pulse to the stop output.

    2. Make the scanner start output low.

    3. Output a HI level for the scanner start output and a negative pulse for the stop output.

  set_output_format(delimiter_format, block_delimiter, terminator)

    Sets the format and terminator of the output data output by GPIB (`FMT`).

    Parameters:

      - delimiter_format (int) – Type of delimiter format

      - block_delimiter (int) – Type of block delimiter

      - terminator (int) – Type of termination character

    The output of <EOI> (End or Identify) is output at the following timing: 1,2: Simultaneously with LF 4: Simultaneously with the last output data

    If the output data format is specified as binary format, the terminator is fixed to <EOI> only and the terminator selection is ignored.

    delimiter_format:

    > 1. ASCII format with header

    > 2. No header, ASCII format

    > 3. Binary format

    block_delimiter:

    > 1. Make it the same as the terminator.

    > 2. Use semicolon ;

    > 3. Use comma ,

    terminator:

    > 1. CR, LF<EOI>

    > 2. LF<EOI>

    > 3. LF

    > 4. <EOI>

    1st character header:

    Normal measurement data

    Measurement data during overrange

    Compliance (limiter) is working.

    Oscillation detection is working.

    [Indicates the generated data]

    Measurement data when an error occurs in the search measurement

    Measurement data is not stored in the buffer memory.

    2nd character header:

    A-channel data during asynchronous operation (A-channel generation data)

    B-channel data during asynchronous operation (B channel generation data)

    A-channel data for synchronous, sweeping, delayed sweep, and double synchronous sweep operations.

    B-channel data for synchronous, sweeping, delayed sweep, and double synchronous sweep operations.

    3rd character header:

    Current generation, voltage measurement (ISVM) [Current generation]

    Voltage generation, current measurement (VSIM) [Voltage generation]

    Current generation, current measurement (ISIM)

    Voltage generation, voltage measurement (VSVM)

    Current generation, external voltage measurement (IS, EXT, VM)

    Voltage generation, external current measurement (VS, EXT, IM)

    Current generation, external current measurement (IS, EXT. IM)

    Voltage generation, external voltage measurement (VS, EXT, VM)

    The measurement data is not stored in the buffer memory.

    4th character header:

    No operation (fixed to A)

    Null operation result

    The result of the comparison operation is GO.

    The result of the comparison operation is LO.

    The result of the comparison operation is HI.

    The result of null operation + comparison operation is GO.

    The result of null operation + comparison operation is LO.

    The result of null operation + comparison operation is HI.

    Measurement data is not stored in the buffer memory.

  property service_request_enable_register

    Control the contents of the service request enable register (SRER) in the form of a `SRER` `IntFlag` (`*SRE`).

    Note

    Bits other than the RQS bit are not cleared by serial polling. When `power_on_clear()` is set, status byte enable register, SESER, device operation enable register, channel operation, the enable register is cleared and no SRQ is issued.

  property event_status_enable

    Control the standard event status enable. (`*ESE`)

  property power_on_clear

    Control the power on clear flag, takes values True or False. (`*PSC`)

  property device_operation_enable_register

    Control the device operation output enable register (DOER) (`DOE?`).

  property digital_out_enable_data

    Control the contents of digital out enable data set (`DIOE`).

  property status_byte_register

    Measure the contents of the status byte register and MSS bits without using a serial poll (`*STB?`).

    The Status Byte Register has a hierarchical structure. ERR, DOP, ESB, and COP bits, except RQS and MAV, have lower-level status registers. Each register is paired with an enable register that can be selected to output to the Status Byte register or not. The status byte register also has an enable register, which allows you to select whether or not to issue a service request SRQ.

    Note

    *STB? command can read bit 6 as MSS (logical OR of other bits).

  property event_status_register

    Measure the contents of the standard event status register (SESR) in the form of a `SESR` `IntFlag` (`*ESR?`).

    Note

    SESR is cleared after being read.

  property device_operation_register

    Measure the contents of the device operations register (DOR) in the form of a `DOR` `IntFlag` (`DOC?`).

  property error_register

    Measure the contents of the error register (`ERR?`).

  property self_test

    A query command that runs a self-test and reads the result (`*TST?`).

  property trigger_link_function_enabled

    Set a boolean that controls whether the trigger link function is enabled, takes values of True or False. (`TLNK`)

    Type:

      bool

  property display_enabled

    Set a boolean that controls whether the display is on or off, takes values of True or False. (`DISP`)

    Type:

      bool

  property line_frequency

    Set the used power supply frequency (`LF`) to 50 or 60hz. With this command, the integration time per PLC for the measurement will be one cycle of the power supply frequency you are using.

    Type:

      int

  property store_config

    Set the memory area for the config to be stored at (`SAV`). There are five memory areas from 0 to 4 for storing.

    Type:

      int

  property load_config

    Set the memory area for the config to be loaded from (`RCL`). There are five areas (0~4) where parameters can be loaded by the RCL command.

    Type:

      int

  set_lo_common_connection_relay(enable, lo_relay=None)

    Turn the connection relay on/off between the A channel LO (internal analog common) and the LO (internal analog common) of the B channel (`LTL`).

    Parameters:

      - enable (bool) – A boolean property that controls whether or not the connection relay is enabled. Valid values are True and False.

      - lo_relay (bool, optional) – A boolean property that controls whether or not the internal analog common relay is enabled. Valid values are True, False and None (don’t change lo relay setting).

  read_measurement()

    Reads the triggered value, for example triggered by the external input.

class pymeasure.instruments.advantest.advantestR624X.SMUChannel(parent, id, voltage_range, current_range)

  Bases: `Channel`

  Instantiated by main instrument class for every SMUChannel

  insert_id(command)

    Insert the channel id in a command replacing placeholder.

    Subclass this method if you want to do something else, like always prepending the channel id.

  clear_measurement_buffer()

    Clears the measurement data buffer (`MBC`).

  set_output_type(output_type, measurement_type)

    Sets the output method and type of the GPIB output (`OFM`).

    Parameters:

      - output_type (int or `OutputType`) – A property that controls the type of output

      - measurement_type (int or `MeasurementType`) – A property that controls the measurement type

    Note

    For the format of the output data, refer to `AdvantestR624X.set_output_format()`. For DC and pulse measurements, the output method is fixed to ‘1’ (real-time output). When the output method ‘3’ (buffering output) is specified, the measured data is not stored in memory.

  property analog_input

    Set the analog input terminal (ANALOG INPUT) on the rear panel ON or OFF (`FL`).

    Type:

      int

      1. Turn off the analog input.

      2. Analog input ON, gain x1.

      3. Analog input ON, gain x2.5.

  property trigger_output_timing

    Set the timing of the trigger output signal output from TRIGGER OUT on the rear panel (`TOT`). the status in the form of a `TriggerOutputSignalTiming` `IntFlag`.

    Type:

      `TriggerOutputSignalTiming`

  set_scanner_control(output, interlock)

    Sets the SCANNER CONTROL (START, STOP) output signal and INTERLOCK input signal on the rear panel (`SCT`).

    Parameters:

      - output (int) – A property that controls the scanner output

      - interlock (int) – A property that controls the scanner interlock type

    output:

    > 1. Scanner, Turn off the control signal output.

    > 2. Output to the scanner control signal at the start / stop of the sweep.

    > 3. Operate / Standby Scanner, Output to the control signal.

    interlock:

    > 1. Turn off the interlock signal input.

    > 2. Set as a stamper when the interlock signal input is HI.

    > 3. When the interlock signal input is HI, it is on standby, and when it is LO, it is operated.

  property trigger_input

    Set the type of trigger input (`TJM`).

    Type:

      `TriggerInputType`

    Trigger input types | 1 | 2 | 3
    --- | --- | --- | ---
    *TRG | O | O | X
    XE 0 | O | O | X
    XE Channel | O | O | O
    GET | O | O | X
    Trigger input signal | O | X | X

    O can be used, X cannot be used

    Note

    The sweep operation cannot be started by the trigger input signal. Be sure to start it with the ‘XE’ command. Once started, it is possible to advance the sweep with a trigger input signal.

  property fast_mode_enabled

    Set the channel response mode to fast or slow, takes values of True or False (`FL`).

    Type:

      bool

  property sample_hold_mode

    Set the integration time of the measurement (`MST`).

    Type:

      `SampleHold`

    Note

    - Valid only for pulse measurement and pulse sweep measurement.

    - In sample hold mode, the AD transformation is just before the fall of the pulse width.

    - The sample hold mode cannot be set during DC measurement and DC sweep measurement. When set to sample-and-hold mode, the integration time is 100 µs. However, in 2-channel synchronous operation, if one channel is in pulse generation and the other is in sample-and-hold mode, the DC measurement side also operates in sample-and-hold mode.

    - When performing pulse measurement and pulse sweep measurement, it is necessary to satisfy the restrictions on the pulse width (Tw), pulse period (Tp), and measure delay time (Td) of the WT command. If the constraint is not satisfied, the integration time is unchanged. To lengthen the integration time, first change the pulse width (Tw) and pulse period (Tp). When shortening the pulse width and pulse cycle, shorten the integration time first.

  set_sample_mode(mode, auto_sampling=True)

    Sets synchronous, asynchronous, tracking operation and search measurement between channels (`JM`).

    Parameters:

      - mode (`SampleMode`) – Sample Mode

      - auto_sampling (bool, optional) – Whether or not auto sampling is enabled, defaults to True

  set_timing_parameters(hold_time, measurement_delay, pulsed_width, pulsed_period)

    Set the hold time, measuring time, pulse width and the pulse period (`WT`).

    Parameters:

      - hold_time (float) – total amount of time for the complete pulse, until next pulse comes

      - measurement_delay (float) – time between measurements

      - pulsed_width (float) – Time specifying the pulse width

      - pulsed_period (float) – Time specifying the pulse period

    Note

    Pulse measurement has the following restrictions depending on the pulse period (Tp) setting. (For pulse sweep measurements, there are no restrictions.)

    > - Tp < 2ms : Not measured.

    > - 2ms <= Tp < 10ms : Measure once every 5 ~ 20ms.

    > - 10ms <= Tp: Measured at each pulse generation.

  select_for_output()

    This is a query command to select a channel and to output the measurement data (`FCH?`). When the output channel is selected by the FCH command, the measured data of the same channel is returned until the output channel is changed by the next FCH command.

    Note

    Reading measurements with the RMM command does not affect channel specification with the FCH command. In the default state, the measurement data of channel A is output.

  trigger()

    Measurement trigger command for sweep, start search measurement or sweep step action (`XE`).

  measure_voltage(enable=True, internal_measurement=True, voltage_range=VoltageRange.AUTO)

    Sets the voltage measurement ON/OFF, measurement input, and voltage measurement range as parameters (`RV`).

    Parameters:

      - enable (bool, optional) – boolean property that enables or disables voltage measurement. Valid values are True (Measure the voltage flowing at the OUTPUT terminal) and False (Measure the voltage from the rear panel -ANALOG COMMON).

      - internal_measurement (bool, optional) – A boolean property that enables or disables the internal measurement.

      - voltage_range (`VoltageRange`, optional) – Specifying voltage range

  voltage_source(source_range, source_value, current_compliance)

    Sets the source range, source value and the current compliance for the DC (constant voltage) measurement (`DV`).

    Parameters:

      - source_range (`VoltageRange`) – Specifying source range

      - source_value (float) – A number specifying the source voltage value

      - current_compliance (float) – A number specifying the current compliance

    Note

    Regardless of the specified current compliance polarity, both polarities (+ and -) are set. The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_pulsed_source(source_range, pulse_value, base_value, current_compliance)

    Sets the source range, pulse value, base value and the current compliance of the pulse (voltage) measurement (`PV`).

    Note

    Regardless of the specified current compliance polarity, both polarities (+ and -) are set. The current compliance range is automatically set to the minimum range that includes the set value.

  property change_source_voltage

    Set new target voltage (`SPOT`).

    Type:

      float

    Note

    Only the DC action source value and pulse action pulse value are changed using the currently set DC action and pulse action parameters. Measure after the change and set the channel to output the measured data to the specified ch. In other words, it’s the same as running the following commands:

    > 1. DV/DI/PV/PI

    > 2. XE xx

    > 3. FCH xx

  voltage_fixed_level_sweep(voltage_range, voltage_level, measurement_count, current_compliance, bias=0)

    Sets the fixed level sweep (voltage) generation range, level value, current compliance and the bias value (`FXV`).

    Note

    Regardless of the specified current compliance polarity, both polarities (+ and -) are set. The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_fixed_pulsed_sweep(voltage_range, pulse, base, measurement_count, current_compliance, bias=0)

    Sets the fixed pulse (voltage) sweep generation range, pulse value, base value, number of measurements, current compliance and the bias value (`PXV`).

    Note

    Regardless of the specified current compliance polarity, both polarities (+ and -) are set. The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_sweep(sweep_mode, repeat, voltage_range, start_value, stop_value, steps, current_compliance, bias=0)

    Sets the sweep mode, number of repeats, source range, start value, stop value, number of steps, current compliance, and the bias value for staircase (linear/log) voltage sweep (`WV`).

    Note

    - Sweep mode, number of repeats, and number of steps are subject to the following restrictions.

      > - Let N = number of steps, m = l (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the OFM command sets the output data output method to 1 or 2 m x number of refreshes x N <= 2048

      >   > - m x N <= 2048 when the OFM command sets the output data output method to 3.

    - Regardless of the specified current compliance polarity, both polarities (+ and -) are set.

    - The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_pulsed_sweep(sweep_mode, repeat, voltage_range, base, start_value, stop_value, steps, current_compliance, bias=0)

    Sets the sweep mode, repeat count, generation range, base value, start value, stop value, number of steps, current compliance and the bias value for a pulse wave (linear/log) voltage sweep (`PWV`).

    Note

    - The sweep mode, number of refreshes, and number of steps are subject to the following restrictions:

      > - Let N = number of steps, m = l (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the OFM command sets the output data output method to 1 or 2 m x number of refreshes x N <= 2048

      >   > - m x N <= 2048 when the OFM command sets the output data output method to 3.

    - For the current compliance polarity, regardless of the specified current compliance polarity, the compliance of both polarities (+ and -) is set.

    - The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_random_sweep(sweep_mode, repeat, start_address, stop_address, current_compliance, bias=0)

    Sets the sweep mode, repeat count, start address, stop address, current compliance and the bias value of constant voltage random sweep (`MDWV`).

    Note

    - Sweep mode, number of repeats, start address and stop address are subject to the following restrictions:

      > - Start address < Stop address

      > - Let N = number of steps, m = l (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the OFM command sets the output data output method to 1 or 2 m x number of refreshes x N <= 2048

      >   > - m x N <= 2048 when the OFM command sets the output data output method to 3.

    - Regardless of the specified current compliance polarity, both polarities (+ and -) are set.

    - The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_random_pulsed_sweep(sweep_mode, repeat, start_address, stop_address, current_compliance, bias=0)

    Sets the sweep mode, repeat count, base value, start address, stop address, current compliance and the bias value of the constant voltage random pulse sweep (`MPWV`).

    Note

    - Sweep mode, number of repeats, start address and stop address are subject to the following restrictions:

      > - Start address < Stop address

      > - Let N = number of steps, m = l (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the OFM command sets the output data output method to 1 or 2 m x number of refreshes x N <= 2048

      >   > - m x N <= 2048 when the OFM command sets the output data output method to 3.

    - Regardless of the specified current compliance polarity, both polarities (+ and -) are set.

    - The current compliance range is automatically set to the minimum range that includes the set value.

  voltage_set_random_memory(address, voltage_range, output, current_compliance)

    The command stores the specified value to the randomly generated data memory (`RMS`).

    Stored generated values are swept within the specified memory address range by the MDWV, MDWI, MPWV, MPWI commands.

  current_source(source_range, source_value, voltage_compliance)

    Sets the source range, source value, voltage compliance of the DC (constant current) measurement (`DI`).

    Parameters:

      - source_range (`CurrentRange`) – Specifying source range

      - source_value (float) – A number specifying the source current value

      - voltage_compliance (float) – A number specifying the voltage compliance

    Note

    Regardless of the specified voltage compliance polarity, both polarities (+ and -) are set. The voltage compliance range is automatically set to the minimum range that includes the set value.

  current_pulsed_source(source_range, pulse_value, base_value, voltage_compliance)

    Sets the source range, pulse value, base value and the voltage compliance of the pulse (current) measurement (`PI`).

    Note

    Regardless of the specified voltage compliance polarity, both polarities (+ and -) are set. The voltage compliance range is automatically set to the minimum range that includes the set value.

  property change_source_current

    Set new target current (`SPOT`).

    Type:

      float

    Note

    Only the DC action source value and pulse action pulse value are changed using the currently set DC action and pulse action parameters. Measure after the change and set the channel to output the measured data to the specified ch. In other words, it’s the same as running the following commands:

    > 1. DV/DI/PV/PI

    > 2. XE xx

    > 3. FCH xx

  current_fixed_level_sweep(current_range, current_level, measurement_count, voltage_compliance, bias=0)

    Sets the fixed level sweep (current) generation range, level value, voltage compliance and the bias value (`FXI`).

    Note

    Regardless of the specified voltage compliance polarity, both polarities (+ and -) are set. The voltage compliance range is automatically set to the minimum range that includes the set value.

  current_fixed_pulsed_sweep(current_range, pulse, base, measurement_count, voltage_compliance, bias=0)

    Sets the fixed pulse (current) sweep generation range, pulse value, base value, number of measurements, voltage compliance and the bias value (`PXI`).

    Note

    Regardless of the specified voltage compliance polarity, both polarities of + and - are set. The voltage compliance range is automatically set to the minimum range that includes the set value.

  current_sweep(sweep_mode, repeat, current_range, start_value, stop_value, steps, voltage_compliance, bias=0)

    Sets the sweep mode, number of repeats, source range, start value, stop value, number of steps, voltage compliance and bias value for the staircase (linear/log) current sweep (`WI`).

    Note

    - The sweep mode, number of refreshes, and number of steps are subject to the following restrictions:

      > - Let N = number of steps, m = l (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the OFM command sets the output data output method to 1 or 2, m x number of repeats x N <= 2048.

      >   > - m x N <= 2048 when the OFM command sets the output data output method to 3.

    - Regardless of the specified voltage compliance polarity, both polarities (+ and -) are set.

    - The voltage compliance range is automatically set to the minimum range that includes the set value.

  current_pulsed_sweep(sweep_mode, repeat, current_range, base, start_value, stop_value, steps, voltage_compliance, bias=0)

    Sets the sweep mode, repeat count, generation range, base value, start value, stop value, number of steps, voltage compliance and the bias value for a pulse wave (linear/log) current sweep (`PWI`).

    Note

    - The sweep mode, number of refreshes, and number of steps are subject to the following restrictions:

      > - Let N = number of steps, m = l (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the OFM command sets the output data output method to 1 or 2, m x number of repeats x N <= 2048.

      >   > - m x N <= 2048 when the OFM command sets the output data output method to 3.

    - Regardless of the specified voltage compliance polarity, both polarities (+ and -) are set.

    - The voltage compliance range is automatically set to the minimum range that includes the set value.

  measure_current(enable=True, internal_measurement=True, current_range=CurrentRange.AUTO)

    Set the current measurement ON/OFF, measurement input, and current measurement range as parameters (`RI`).

    Parameters:

      - enable (bool, optional) – boolean property that enables or disables current measurement. Valid values are True (Measure the current flowing at the OUTPUT terminal) and False (Measure the current from the rear panel -ANALOG COMMON).

      - internal_measurement (bool, optional) – A boolean property that enables or disables the internal measurement.

      - current_range (`CurrentRange`, optional) – Specifying voltage range

  current_random_sweep(sweep_mode, repeat, start_address, stop_address, current_compliance, bias=0)

    Sets the sweep mode, repeat count, start address, stop address, voltage compliance and the bias value of constant current random sweep (`MDWI`).

    Note

    - Sweep mode, number of repeats, start address and stop address are subject to the following restrictions:

      > - Start address < Stop address

      > - Let N = (stop number 1 - start number + 1), m = 1 (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the output data output method is set to 1 or 2 with the OFM command m x number of repeats x N <= 2048

      >   > - When the output data output method is set to 3 with the OFM command m x N <= 2048

    - For the voltage compliance polarity, regardless of the specified voltage compliance polarity, both polarities of + and – are set.

    - The voltage compliance range is automatically set to the minimum range that includes the set value.

  current_random_pulsed_sweep(sweep_mode, repeat, start_address, stop_address, current_compliance, bias=0)

    Sets the sweep mode, repeat count, base value, start address, stop address, voltage compliance and the bias value of constant current random pulse sweep (`MPWI`).

    Note

    - Sweep mode, number of repeats, start address and stop address are subject to the following restrictions:

      > - Start address < Stop address

      > - Let N = (stop number 1 - start number + 1), m = 1 (one-way sweep), m = 2 (round-trip sweep).

      >   > - When the output data output method is set to 1 or 2 with the OFM command m x number of repeats x N <= 2048

      >   > - When the output data output method is set to 3 with the OFM command m x N <= 2048

    - For the voltage compliance polarity, regardless of the specified voltage compliance polarity, both polarities of + and – are set.

    - The voltage compliance range is automatically set to the minimum range that includes the set value.

  current_set_random_memory(address, current_range, output, voltage_compliance)

    Store the current parameters to randomly generated data memory (`RMS`).

    Stored generated values are swept within the specified memory address range by the MDWV, MDWI, MPWV, MPWI commands.

  read_random_memory(address)

    Return memory specified by address location (`RMS?`).

    Parameters:

      address (int) – Adress to specify memory location.

    Returns:

      Set values returned by the device from the specified address location.

    Return type:

      str

  enable_source()

    Put the specified channel into an operating state (`CN`).

  standby()

    Put the specified channel into standby state (`CL`).

  stop()

    Stops the sweep when the sweep is started by the XE command or the trigger input signal (`SP`).

  output_all_measurements()

    Output all measurements in the measurement data buffer of the specified channel (`RMM?`).

    Note

    For the output format, refer to `AdvantestR624X.set_output_format()`. When a memory address where no measurement data is stored is read, 999.999E+99 will be returned.

  read_measurement_from_addr(addr)

    Output only one measurement at the specified memory address from the measurement data buffer of the specified channel.

    Parameters:

      addr (int) – Specifies the address to read from.

    Returns:

      float Measurement data

    Note

    For the output format, refer to `AdvantestR624X.set_output_format()`. When a memory address where no measurement data is stored is read, 999.999E+99 will be returned.

  property measurement_count

    Measaure the number of measurements contained in the measurement data buffer (`NUB?`).

  property null_operation_enabled

    Set a boolean that controls whether the null operation is enabled, takes values of True or False (`NUG`).

    Type:

      bool

    Note

    - Null data is not rewritten even if the null operation is disabled.

    - Null data is rewritten only when null operation is changed from OFF to ON or initialized in case of DC operation or pulse operation.

  set_wire_mode(four_wire, lo_guard=True)

    Used to switch remote sense and to set the LO-GUARD relay ON/OFF. It operates regardless of operating state or standby state (`OSL`).

    Parameters:

      - four_wire (bool) – A boolean property that enables or disables four wire measurements. Valid values are True (enables 4-wire sensing) and False (enables two-terminal sensing).

      - lo_guard (bool) – A boolean property that enables or disables the LO-GUARD relay.

  property auto_zero_enabled

    Set the auto zero option to ON or OFF. Valid values are True (enabled) and False (disabled) (`CM`).

    Type:

      bool

    This command sets auto zero (automatically calibrate the zero point of the measured value operation.

    1. Periodically perform auto zero.

    2. Auto zero once, no periodic auto zeros thereafter.

    When the auto zero mode is set to True, the following operations are performed.

    - For DC operation and pulse operation:

      > - At the end of one sweep, if he has exceeded the last autozero by more than 10 seconds, he will do one autozero.

      > - If sweep start is specified during auto zero, the sweep will start after auto zero ends.

    - Sweep operation

      > - Auto zero is performed once every 10 seconds.

      > - If measurement or pulse output is specified during auto zero, it will be executed after auto zero ends.

  set_comparison_limits(comparison, voltage_value, upper_limit, lower_limit)

    Sets the channel ON/OFF based on the measurement comparison and the data of the upper and lower limits to be compared (`CMD`).

    Parameters:

      - comparison (bool) – A boolean property that controls whether or not the comparison function is enabled. Valid values are True or False.

      - voltage_value (bool) – A boolean property that controls whether or not voltage or current values are passed. Valid values are True or False.

      - upper_limit (float) – Number specifying the upper comparison limit

      - lower_limit (float) – Number specifying the lower comparison limit

  property relay_mode

    Set the HI/LO relays for standby mode. This command does not operate the Operate Relay (`OPM`).

    Type:

      int

    1. When executing an operation only the HI side turns ON, in standby both HI and LO are turned OFF.

    2. When executing an operation only the LO side turns ON, in standby both HI and LO are turned OFF.

    3. When executing an operation both HI and LO turn ON, in standby both HI and LO are turned OFF.

    4. When executing an operation only the HI side turns ON, in standby only the HI side is turned OFF.

  property operation_register

    Measure the contents of the Channel Operations Register (COR) in the form of a `COR` `IntFlag` (`COC?`).

  property output_enable_register

    Control the settings of the channel operation output enable register (COER) in the form of a `COR` IntFlag ?(`COE?`).

  calibration_init()

    Initialize the calibration data (`CINI`).

  calibration_store_factor()

    Store the calibration factor in the non-volatile memory (EEPROM) (`CSRT`).

  property calibration_measured_value

    Set the measured value measured by an external standard for the generated value of this instrument and start calibration (`STD`).

    Type:

      float

  property calibration_generation_factor

    Set the increment or decrement for the generation calibration factor of the current generation range (`CCS`). It is used when the generated value deviates from the true value.

    Type:

      float

  property calibration_factor

    Set the increment of the measurement calibration factor of the current measurement range (`CCM`).

    Type:

      float

class pymeasure.instruments.advantest.advantestR624X.SampleHold(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.SampleMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.VoltageRange(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.CurrentRange(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.SweepMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.OutputType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.TriggerInputType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.MeasurementType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

class pymeasure.instruments.advantest.advantestR624X.SequenceInterruptionType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

  1. Release pause state is a valid command only in the sequence program pause state. otherwise it is ignored.

  2. Pause state enters the pause state when the currently executing program ends.

  3. Abort sequence program stops the sequence program when the currently executing program ends. If the currently running program is a sweep operation, interrupt the sweep operation and stop the sequence program. The output value will be the bias value.

class pymeasure.instruments.advantest.advantestR624X.DOR(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  bit assigment for the Device Operation Register (DOR):

  Bit (dec) | Description
  --- | ---
  13 | Indicates that the fast tokens program is running.
  12 | Error in search measurement
  11 | End of sequence program/high-speed sequence program execution
  10 | Sequence program Pause state
  9 | Fan stop detection
  8 | Self-test error occurred (logic part)
  7 | Trigger wait state in trigger link master operation
  6 | Calibration mode status
  5 | Trigger link ON state
  4 | Trigger link bus error
  3 | Sequence program/high-speed sequence 1 program/add/de) waiting
  2 | Wait for sequence program wait time
  1 | Sequence program running
  0 | Synchronous operation state

class pymeasure.instruments.advantest.advantestR624X.COR(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  bit assigment for the Channel Operations Register (COR):

  Bit (dec) | Description
  --- | ---
  14 | The result of the comparison operation is HI
  13 | The result of the comparison operation is GO
  12 | The result of the comparison operation is LO
  11 | Overheat detection
  10 | Overload detection
  9 | Oscillation detection
  8 | Compliance detection
  7 | Synchronous operation master channel
  6 | Measurement data output specification
  5 | There is measurement data
  4 | Self-test error occurrence (analog part)
  3 | Measurement data buffer full
  2 | Waiting for trigger
  1 | End of sweep
  0 | Operated state

class pymeasure.instruments.advantest.advantestR624X.SRER(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  bit assigment for the Service Request Enable Register (SRER):

  Bit (dec) | Description
  --- | ---
  0 | none
  1 | ERR Set when any of QYE, DDE, EXE, or CME in the Standard Event Status Register (SESR) is set.
  2 | DOP Set when a bit in the device operation register for which the enable register is set to enabled is set. Cleared by reading the device operation register.
  3 | none
  4 | MAV Set when output data is set in the output queue. Cleared when output data is read.
  5 | ESB Set when a bit in the Standard Event Status Register (SESR) is set and the enable register is set to Enabled. Cleared by reading SESR.
  6 | RQS (MSS) Set when bit O to bit 5 and bit 7 of the Status Byte register are set. (this bit is read-only)
  7 | COP Set when a bit in the Channel Operations Register is set with the Enable Register set to Enable. Cleared by reading the Channel Operations Register.

class pymeasure.instruments.advantest.advantestR624X.SESR(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  bit assigment for the Standard Event Status Register (SESR):

  Bit (dec) | Description
  --- | ---
  0 | OPC (Operation Complete) not used
  1 | RQC unused
  2 | QYE (Query Error) Set when the output queue overflows when reading without output data.
  3 | DDE (Device Dependent Error) Set when an error occurs in the self-test.
  4 | EXE (Execution Error) Set when the input data is outside the range set internally, or when the command cannot be executed.
  5 | CME (Command Error) Set when an undefined header or data format is wrong, or when there is a syntax error in the command.
  6 | URQ unused
  7 | PON Set when power is switched from OFF to ON.

class pymeasure.instruments.advantest.advantestR624X.TriggerOutputSignalTiming(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  bit assigment for the timing of the trigger output signal output from TRIGGER OUT on the rear panel:

  > Bit (dec) | Description
  > --- | ---
  > 5 | At the end of the sweep
  > 4 | At the end of the pulse width
  > 3 | At the end of the pulse cycle
  > 2 | At the end of measurement
  > 1 | At the start of measurement
  > 0 | At the start of occurrence

## General Information

The R6245/6246 Series are DC voltage/current sources and monitors having source measurement units (SMUs) with 2 isolated channels. The series covers wide source and measurement ranges. It is ideal for measurement of DC characteristics of items ranging from separate semiconductors such as bipolar transistors, MOSFETs and GaAsFETs, to ICs and power devices. Further, due to the increased measuring speed and synchronized 2-channel measurement function, device I/O characteristics can be measured with precise timing at high speed which was previously difficult to accomplish. Due to features such as the trigger link function and the sequence programming function which automatically performs a series of evaluation tests automatically, the R6245/6246 enable much more efficient evaluation tests.

There is a total of 99 commands, the majority of commands have been implemented. Device documentation is in Japanese, and the device options are enormous. The implementation is based on 6245S-GPIB-B-FHJ-8335160E01.pdf, which can be downloaded from the ADCMT website.

## Examples

### Initialization of the Instrument

    from pymeasure.instruments.advantest import AdvantestR6246
    from pymeasure.instruments.advantest.advantestR624X import *

    smu = AdvantestR6246("GPIB::1")

### Simple dual channel measurement example

Measurement characteristics:

  Channel A: Vce = 20V Channel B: Ib = 10uA - 60uA

    smu = AdvantestR6246("GPIB::1")
    smu.reset()                                               # Set default parameters
    smu.ch_A.set_sample_mode(SampleMode.PULSED_SYNC)          # Pulsed synchronized
    smu.ch_A.voltage_source(source_range = VoltageRange.AUTO,
                            source_value = 20,
                            current_compliance = 0.06)
    smu.ch_A.measure_current()
    smu.ch_B.current_source(source_range = CurrentRange.AUTO,
                            source_value = 1E-5,              # Source current at 10 uA
                            voltage_compliance = 5)           # Voltage compliance at 5 V
    smu.ch_B.measure_voltage()
    smu.enable_source()                                       # Enables source A & B

    for i in range(10, 60):
        k = i * 0.000001
        smu.ch_B.current_change_source = k                    # Set current from 10 uA to 60 uA

        smu.trigger()                                         # Trigger measurement
        smu.ch_A.select_for_output()
        Ic = smu.read_measurement()                           # Read channel A measurement
        smu.ch_B.select_for_output()
        Vbe = smu.read_measurement()                          # Read channel B measurement
        print(f'Ic={Ic}, Vbe={Vbe}')                          # Print measurements

    smu.standby()                                             # Put channel A & B in standby

### Program example for DC measurement

Measurement characteristics:

  Function: VSIM - Source voltage and measure current Trigger voltage: 10V Current compliance: 0.5A Measurement delay time: 1ms Integration time: 1 PLC Response: Fast

After operating, the measurement is repeated 10 times with a trigger command and he prints out the results.

    smu = AdvantestR6246("GPIB::1")
    smu.reset()                                                      # Set default parameters
    smu.ch_A.set_sample_mode(SampleMode.ASYNC, False)                # Asynchronous operation and single shot sampling by trigger and command
    smu.ch_A.voltage_source(source_range = VoltageRange.FIXED_BEST,
                            source_value = 10,
                            current_compliance = 0.5)                # compliance of 0.5A
    smu.ch_A.measure_current()                                       # Measure current
    smu.ch_A.set_timing_parameters(hold_time = 0,                    # 0 sec hold time
                                   measurement_delay = 1E-3,         # 1ms delay between measurements
                                   pulsed_width = 5E-3,              # 5ms pulse width
                                   pulsed_period = 10E-3)            # 10ms pulse period
    smu.ch_A.sample_hold_mode = SampleHold.MODE_1PLC                 # Sample at 1 power line cycle
    smu.ch_A.fast_mode_enabled = True                                # Set channel response to fast
    smu.ch_A.enable_source()                                         # Set channel in operating state
    smu.ch_A.select_for_output()                                     # Select channel for measurement output

    for i in range(1, 10):
        smu.ch_A.trigger()                                           # Trigger a measurement
        measurement = smu.read_measurement()
        print(f"NO {i} {measurement}")

    smu.ch_A.standby()                                               # Put channel A in standby mode

### Program example for DC measurement (with external trigger)

Measurement characteristics:

  Function: VSIM - Source voltage and measure current Source voltage: 10 V Base voltage 1 V Current compliance: 0.5 A Pulse width: 5 ms Pulse period: 10 ms Measurement delay time: 1 ms Integration time: 1 ms Response: Fast

After operating, an external trigger input signal is pulsed to measure the channel operation register. Reads the fixed end bit, captures the measurement data, and prints out the measurement result.

    smu = AdvantestR6246("GPIB::1")
    smu.reset()                                                      # Set default parameters

    smu.ch_A.auto_zero_enabled = False
    smu.ch_A.set_sample_mode(SampleMode.ASYNC, False)                # Asynchronous operation and single shot sampling by trigger and command
    smu.ch_A.voltage_pulsed_source(
          source_range = VoltageRange.FIXED_BEST,
          pulse_value = 10,
          base_value = 1,
          current_compliance = 0.5)
    smu.ch_A.measure_current()                                       # Measure current
    smu.ch_A.fast_mode_enabled = True                                # Set channel response to fast
    smu.ch_A.sample_hold_mode = SampleHold.MODE_1mS                  # Sample at 1mS
    smu.ch_A.set_timing_parameters(hold_time = 0,                    # 0 sec hold time
                                   measurement_delay = 1E-3,         # 1ms delay between measurements
                                   pulsed_width = 5E-3,              # 5ms pulse width
                                   pulsed_period = 10E-3)            # 10ms pulse period
    smu.ch_A.trigger_input = TriggerInputType.ALL                    # Mode 1 enables the trigger input signal
    smu.ch_A.output_enable_register = COR.HAS_MEASUREMENT_DATA       # Measurement data available
    smu.service_request_enable_register = SRER.COP                   # COP Set when a bit in the Channel Operations Register is set with the Enable Register set to Enable.
    smu.ch_A.enable_source()                                         # Set channel in operating state
    smu.ch_A.select_for_output()                                     # Select channel for measurement output

    for i in range(1, 10):
        while not smu.ch_A.operation_register & COR.HAS_MEASUREMENT_DATA:
            pass

        measurement = smu.read_measurement()
        print(f"NO {i} {measurement}")

        while not smu.ch_A.operation_register & COR.WAITING_FOR_TRIGGER:
            pass

    smu.ch_A.standby()                                               # Put channel A in standby mode

### Program example for pulse measurement

Measurement characteristics:

  Function: ISVM - Source current and measure voltage Pulse generation current: 100mA Base current: 1mA Voltage compliance: 5V Pulse width: 0 Pulse period : 0 Measurement delay time: 0 Integration time: 1ms Response: Fast

After the operation, repeat the measurement 10 times with the trigger command and print out the measurement results.

    smu = AdvantestR6246("GPIB::1")
    smu.reset()                                                         # Set default parameters
    smu.ch_A.set_sample_mode(SampleMode.ASYNC, auto_sampling = False)
    smu.ch_A.current_pulsed_source(
          source_range = CurrentRange.FIXED_600mA,
          pulse_value = 0.1,                                            # 100mA
          base_value = 1E-3,                                            # 1mA
          voltage_compliance = 5)                                       # 5V
    smu.ch_A.measure_voltage(voltage_range = VoltageRange.FIXED_BEST)
    smu.ch_A.fast_mode_enabled = True                                   # Set channel response to fast
    smu.ch_A.sample_hold_mode = SampleHold.MODE_1mS                     # Sample at 1mS
    smu.ch_A.set_timing_parameters(hold_time = 0,                       # 0 sec hold time
                                   measurement_delay = 0,               # 0 sec delay between measurements
                                   pulsed_width = 0,                    # 0 sec pulse width
                                   pulsed_period = 0)                   # 0 sec pulse period
    smu.ch_A.enable_source()                                            # Set channel in operating state
    smu.ch_A.select_for_output()                                        # Select channel for measurement output

    for i in range(1, 10):
        smu.ch_A.trigger()                                              # Trigger measurement

        measurement = smu.read_measurement()
        print(f"NO {i} {measurement}")

        while not smu.ch_A.operation_register & COR.WAITING_FOR_TRIGGER:
            pass

    smu.ch_A.standby()                                                  # Put channel A in standby mode

### Fixed Level Sweep Program Example

Measurement characteristics:

  function: VSVM - Voltage source and voltage measurement Level value: 15V Bias value: 0V Number of measurements: 20 times Compliance: 6mA Measuring range: Best fixed range (=60V range) Integration time: 100us Measurement delay time: 0 Hold time: 1ms Sampling mode: automatic sweep Measurement data output method: Buffering output (output of specified data)

After operating, make 20 measurements in fixed sweep. Detect the end of sweep by looking at the Channel Operation Register (COR). After the sweep is finished, read the measured data from 1 to 2 using the RMM command.

    smu = AdvantestR6246("GPIB::1")

    # First we setup our main parameters
    smu.reset()                                                      # Set default parameters

    smu.ch_A.set_output_type(output_type = OutputType.BUFFERING_OUTPUT_SPECIFIED,
                             measurement_type = MeasurementType.MEASURE_DATA)

    smu.set_output_format(delimiter_format = 2,                      # No header, ASCII format
                          block_delimiter = 1,                       # Make it the same as the terminator
                          terminator = 1)                            # CR, LF<EOI>

    smu.ch_A.analog_input = 1                                        # Turn off the analog input.

    smu.set_lo_common_connection_relay(enable = True)                # Turns the connection relay on

    smu.ch_A.set_wire_mode(four_wire = False,                        # disable four wire measurements
                           lo_guard = True)                          # enable the LO-GUARD relay.

    smu.ch_A.auto_zero_enabled = False
    smu.ch_A.trigger_input = TriggerInputType.ALL                    # Mode 1 enables the trigger input signal

    # Now we set measurement specific variables
    smu.ch_A.clear_measurement_buffer()
    smu.ch_A.set_sample_mode(SampleMode.ASYNC, auto_sampling = True)
    smu.ch_A.voltage_fixed_level_sweep(voltage_range = VoltageRange.FIXED_60V,
                                       voltage_level = 15,
                                       measurement_count = 20,       # 20 measurements
                                       current_compliance = 6E-3,    # compliance at 6mA
                                       bias = 0)
    smu.ch_A.measure_voltage(voltage_range = VoltageRange.FIXED_BEST)
    smu.ch_A.sample_hold_mode = SampleHold.MODE_100uS
    smu.ch_A.set_timing_parameters(hold_time = 1E-3,                 # 1ms sec hold time
                                   measurement_delay = 0,            # 0 sec delay between measurements
                                   pulsed_width = 0,                 # 0 sec pulse width
                                   pulsed_period = 0)                # 0 sec pulse period

    smu.ch_A.enable_source()                                         # Set channel in operating state
    smu.ch_A.trigger()                                               # Start the sweep

    while not smu.ch_A.operation_register & COR.END_OF_SWEEP:        # Wait until the sweep is done
        pass

    # Read measurements
    for i in range(1, 20):
        measurement = smu.ch_A.read_measurement_from_addr(i)
        print(i, measurement)

    smu.ch_A.standby()                                               # Put channel A in standby mode