Model 2461 Interactive SourceMeter® Instrument Reference Manual
Section 3: Functions and features
2461-901-01 A/November 2015
3-27
Reading buffer for . . . do loops
The following TSP examples illustrate the use of for . . . do loops when recalling data from a reading
buffer called
mybuffer
. The following code may be sent as one command line or as part of a script.
Example outputs follow the line of code. Also see the
(on page 8-93) command.
This example loop uses the
printbuffer()
command to show the reading, units, and relative
timestamps for all readings stored in the reading buffer. The information for each reading (reading,
units, and relative timestamps) is shown on a single line with the elements comma-delimited.
for x = 1, mybuffer.n do
printbuffer(x,x,mybuffer, mybuffer.units, mybuffer.relativetimestamps)
end
Example comma-delimited output of above code:
-1.5794739960384e-09, Amp DC, 0
-1.5190692453926e-11, Amp DC, 0.411046134
-2.9570144943758e-11, Amp DC, 0.819675745
-2.9361919146043e-11, Amp DC, 1.228263492
-3.0666566508408e-11, Amp DC, 1.636753752
-4.0868204653766e-11, Amp DC, 2.034403917
The following loop uses the
command instead of the
printbuffer
command. This loop
shows the same information described in the previous example (reading, units, and relative
timestamps for all readings stored in the buffer). However, because the
print()
command is used
instead of
printbuffer()
, each line is tab-delimited (rather than comma-delimited) to produce a
columnar output, as shown below:
for x = 1, mybuffer.n do
print(mybuffer.readings[x], mybuffer.units[x], mybuffer.relativetimestamps[x])
end
Example columnar-delimited output of above code:
-1.5794739960384e-09 Amp DC
0
-1.5190692453926e-11 Amp DC
0.411046134
-2.9570144943758e-11 Amp DC
0.819675745
-2.9361919146043e-11 Amp DC
1.228263492
-3.0666566508408e-11 Amp DC
1.636753752
-4.0868204653766e-11 Amp DC
2.034403917
Writable reading buffers
Writable reading buffers allow you to add external data manually to a user-defined buffer on the
Model 2461.
You can create a writable buffer by specifying the writable or full writable style when you create the
buffer over a remote interface using SCPI or Test Script Processor (TSP
®
) commands. You cannot
create a writable buffer from the Model 2461 front panel.
The writable buffer is for input of external data only.
Be aware that when you create a writable buffer, it immediately becomes the active buffer. If you
then try to save readings from the instrument to the writable buffer, errors will occur.