Posted 2 months ago 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:

  1. function run_experiment(voltageLevel, voltageApplicationTime, samplingInterval)
  2.  
  3. chargingTimer = trigger.timer[1]
  4. chargingTimer.count = voltageApplicationTime / samplingInterval
  5.  
  6. chargingTimer.delay = samplingInterval
  7.  
  8. smub.reset()
  9.  
  10. smub.source.func = smub.OUTPUT_DCVOLTS
  11. smub.source.rangev = voltageRange
  12. smub.nvbuffer1.appendmode=1
  13. smub.measure.rangei = 0.01 -- Set current range for measurement
  14. smub.measure.autozero = smub.AUTOZERO_OFF
  15. smub.measure.autorangei = smub.AUTORANGE_OFF
  16. smub.measure.count = voltageApplicationTime / samplingInterval
  17. smub.trigger.measure.i(smub.nvbuffer1) -- Measure current into buffer1
  18. smub.trigger.measure.action = 1
  19. smub.trigger.measure.stimulus = chargingTimer.SOURCE_COMPLETE_EVENT_ID
  20.  
  21. chargingTimer.stimulus = smub.trigger.ARMED_EVENT_ID
  22.  
  23. smub.source.levelv = voltageLevel
  24. smub.source.output = smub.OUTPUT_ON
  25.  
  26. waitcomplete()
  27.  
  28. if smub.nvbuffer1.n > 0 then
  29. printbuffer(1, smub.nvbuffer1.n, smub.nvbuffer1.readings)
  30. else
  31. print("No data in nvbuffer1.")
  32. end
  33.  
  34. 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 2 months ago 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!
  1. smub.measure.nplc = samplingInterval * 50 --effective timing interval
  2.  
  3. --setup smu:
  4. smub.source.func = smub.OUTPUT_DCVOLTS
  5. smub.source.rangev = 20.0
  6. smub.nvbuffer1.appendmode = 1
  7. smub.measure.rangei = 0.01
  8. smub.measure.autozero = smub.AUTOZERO_OFF
  9. smub.measure.autorangei = smub.AUTORANGE_OFF
  10.  
  11. --setup the measurement:
  12. smub.measure.count = math.floor(voltageApplicationTime / samplingInterval)
  13. smub.trigger.measure.i(smub.nvbuffer1)
  14. smub.trigger.measure.action = smub.ENABLE
  15.  
  16. --initiate measurement:
  17. smub.source.levelv = voltageLevel
  18. smub.source.output = smub.OUTPUT_ON
  19. smub.trigger.initiate()

You must be signed in to post in this forum.