Posted Tue, 14 Jan 2025 16:35:42 GMT by Killilea, Niall

Hi all,

I am looking for help with a measurement using a Keithley 2612B. What I want to do is

1. Apply a set voltage (typically ~4V)

2. Immediately begin recording current data to a buffer

3. After a set amount of time/counts of measurements turn off the voltage

Here is my Lua code:

function run_experiment(voltageLevel, voltageApplicationTime, samplingInterval)

    chargingTimer = trigger.timer[1]
    chargingTimer.count = voltageApplicationTime / samplingInterval

    chargingTimer.delay = samplingInterval

    smub.reset()

    smub.source.func = smub.OUTPUT_DCVOLTS
    smub.source.rangev = voltageRange
    
    smub.nvbuffer1.appendmode=1
    
    smub.measure.rangei = 0.01             -- Set current range for measurement
    smub.measure.autozero = smub.AUTOZERO_OFF
    smub.measure.autorangei = smub.AUTORANGE_OFF
    smub.measure.count = voltageApplicationTime / samplingInterval
    smub.trigger.measure.i(smub.nvbuffer1)  -- Measure current into buffer1
    smub.trigger.measure.action = 1
    smub.trigger.measure.stimulus = chargingTimer.SOURCE_COMPLETE_EVENT_ID

    chargingTimer.stimulus = smub.trigger.ARMED_EVENT_ID

    smub.source.levelv = voltageLevel
    smub.source.output = smub.OUTPUT_ON

    waitcomplete()

    if smub.nvbuffer1.n > 0 then
        printbuffer(1, smub.nvbuffer1.n, smub.nvbuffer1.readings)
    else
        print("No data in nvbuffer1.")
    end

end

What am I doing wrong? No data is being created in the buffer and I do not understand why. No errors are being created either. For first tests I set samplingInterval = 0.1 to make things simple but always there is nothing in the buffer!

Additionally, voltageApplicationTime is set to 5.0 so values generally are sensible.

Any help is greatly appreciated thanks!!!

Posted Tue, 21 Jan 2025 07:59:32 GMT by Killilea, Niall
OK so I have a hideous solution to this problem - to use the integration time as the sampling interval. Any update on how to use the timer is welcome, or otherwise if there are any issues with how I chose to do this, thanks to anyone reading!
    smub.measure.nplc = samplingInterval * 50  --effective timing interval

   --setup smu:
    smub.source.func = smub.OUTPUT_DCVOLTS
    smub.source.rangev = 20.0
    smub.nvbuffer1.appendmode = 1
    smub.measure.rangei = 0.01
    smub.measure.autozero = smub.AUTOZERO_OFF
    smub.measure.autorangei = smub.AUTORANGE_OFF

  --setup the measurement:
    smub.measure.count = math.floor(voltageApplicationTime / samplingInterval)
    smub.trigger.measure.i(smub.nvbuffer1)
    smub.trigger.measure.action = smub.ENABLE

  --initiate measurement:
    smub.source.levelv = voltageLevel
    smub.source.output = smub.OUTPUT_ON
    smub.trigger.initiate()

You must be signed in to post in this forum.