Section 6: Reading buffers
2470 High Voltage SourceMeter Instrument Reference Manual
6-28
2470-901-01 Rev. A /
May
2019
Accessing the data in buffers
Using SCPI commands:
To access a buffer, include the buffer name in the respective command. For example, the following
commands:
•
Create a buffer named
testData
to store 100 readings
•
Set the instrument to make five readings for all measurement requests
•
Make the readings and store them in the buffer
•
Return five readings (including the measurement and relative time) from the user-defined buffer
named
testData
TRAC:MAKE "testData", 100
SENS:COUN 5
TRAC:TRIG "testData"
TRAC:DATA? 1, 5, "testData", READ, REL
Using TSP commands:
A reading buffer is based on a Lua table. When you use TSP commands, the measurements
themselves are accessed by ordinary array notation. If
rb
is a reading buffer, the first measurement is
accessed as
rb[1]
, the ninth measurement as
rb[9]
, and so on. The additional information in the
table is accessed as additional members of the table.
To access a buffer, include the buffer name in the respective command. For example, the following
commands:
•
Create a buffer named
testData
to store 100 readings
•
Set the instrument to make five readings for all measurement requests
•
Make the readings and store them in the buffer
•
Return five readings (including the measurement and relative time) from the user-defined buffer
named
testData
-- Create a buffer named testData to store 100 readings.
testData = buffer.make(100)
-- Set the instrument to make 5 readings and store them in the buffer.
trigger.model.load("SimpleLoop", 5, 0, testData)
-- Make the readings
trigger.model.initiate()
waitcomplete()
-- Read the 5 readings and print them including the measurement
-- and relative time for each reading.
printbuffer(1, 5, testData.readings, testData.relativetimestamps)