2-34 Return to Section Topics 2600S-901-01 Rev. C / January 2008
Section 2: TSP Programming Series 2600 System SourceMeter® Instruments Reference Manual
Use the following code fragment to write to one bit of the Digital I/O port. The I/O bit is then read
and the state is returned to the PC where it is displayed.
digio.writebit(4,0) -- Writes a “0” to I/O bit 4.
data=digio.readbit(4) -- Reads I/O bit 4.
print(data) -- PC displays state of I/O bit 4.
Display user-defined messages
The operator can define and display messages on the front panel display of the SourceMeter. The
following code fragment displays the “Test in Process” message on the SourceMeter display:
display.clear() -- Clears display of messages.
display.settext("Test in Process") -- Displays message.
Displayed messages and input prompts are used in scripts to prompt the operator to enter
parameter values from the front panel. See “
Interactive script” (later in this section) for more
information.
User scripts
User scripts can be written using your own program or the Test Script Builder. User scripts are
loaded into the Series 2600 and can be saved in non-volatile memory. Scripts not saved in non-
volatile memory will be lost when the Series 2600 is turned off.
Script examples
Script using commands and statements only
The script in Table 2-1 sweeps voltage (1V to 5V) and measures current at each step. The five
current readings are returned to the host computer:
Table 2-1
Example script to sweep V and measure I
Test Script Builder User’s Program Script
loadscript
current = {} current = {}
smua.source.output = smua.OUTPUT_ON smua.source.output = smua.OUTPUT_ON
for j = 1, 5 do for j = 1, 5 do
smua.source.levelv = j smua.source.levelv = j
current[j] = smua.measure.i() current[j] = smua.measure.i()
print(current[j]) print(current[j])
end end
smua.source.output = smua.OUTPUT_OFF smua.source.output = smua.OUTPUT_OFF
endscript