Section 10: Instrument programming Model 2601B-PULSE System SourceMeter Instrument Reference Manual
10-12 2601B-PULSE-901-01A April 2020
Example: Delete a user script from nonvolatile memory
Delete a user script named test8 from nonvolatile memory.
Interactive script example
An interactive script prompts the operator to input values using front panel controls. The following
example script uses display messages to prompt the operator to:
• Enter the voltage level to source
• Enable or disable measurements
• Set the number of readings if measurements are enabled
After the operator completes entering values, the output turns on and sources the specified value. If
measurements were enabled, a message indicates that measurements are in progress. Another
message is displayed when the source-measure operation is complete. If measurements were not
enabled, the message indicates that the source operation is complete.
When an input prompt is displayed, the script waits until the operator inputs the parameter or presses
the ENTER key. The example shown here assumes that you are using TSB. If you are using a remote
interface, you need to add the loadscript and endscript commands to the example code. See
Load a script by sending commands over the remote interface (on page 10-4) for details.
reset()
-- Clear the display.
display.clear()
-- Prompt the user for a voltage value to source.
srcVoltage = display.prompt("+000.00", " V", "Enter source voltage", 5, -20, 20)
-- Prompt the user to enable measurements.
measEnable = display.menu("Measurements?", "ENABLE DISABLE")
if measEnable == "ENABLE" then
-- Prompt the user for the number of measurements.
numMeas = display.prompt("0000", " Rdgs", "Enter the number of readings", 10,
0, 9999)
smua.measure.count = numMeas
smua.nvbuffer1.clear()
end
-- Convert user input to the source level.
smua.source.levelv = tonumber(srcVoltage)
smua.source.output = smua.OUTPUT_ON