Dynamically allocated buffer example
The programming example below illustrates how to store data to an allocated buffer called mybuffer.
The 2600B stores 100 current readings in mybuffer and then recalls all the readings.
-- Restore 2600B defaults.
smua.reset()
-- Select measure I autorange.
smua.measure.autorangei = smua.AUTORANGE_ON
-- Select measure V autorange.
smua.measure.autorangev = smua.AUTORANGE_ON
-- Select ASCII data format.
format.data = format.ASCII
-- Set the buffer count to 100.
smua.measure.count = 100
-- Set the measure interval to 0.1 s.
smua.measure.interval = 0.1
-- Select the source voltage function.
smua.source.func = smua.OUTPUT_DCVOLTS
-- Set the source voltage to output 1 V.
smua.source.levelv = 1
-- Turn on the output.
smua.source.output = smua.OUTPUT_ON
-- Create a temporary reading buffer.
mybuffer = smua.makebuffer(smua.measure.count)
-- Store current readings in mybuffer.
smua.measure.overlappedi(mybuffer)
-- Wait for the buffer to fill.
waitcomplete()
-- Turn off the output.
smua.source.output = smua.OUTPUT_OFF
-- Output readings 1 to 100 from mybuffer.
printbuffer(1, 100, mybuffer)
-- Delete mybuffer.
mybuffer = nil