Keithley 2601B Reference Manual page 293

2600b series system sourcemeter instrument
Hide thumbs Also See for 2601B:
Table of Contents

Advertisement

Section 6: Instrument programming
To execute a function, substitute appropriate values for parameterX and insert them into a message
formatted as:
myFunction(valueForParameterX, valueForParameterY)
Where valueForParameterX and valueForParameterY represent the values to be passed to
the function call for the given parameters.
The output you get from these examples will vary depending on the data format settings of the
instrument.
Example 1
function add_two(first_value,
second_value)
return first_value + second_value
end
print(add_two(3, 4))
Example 2
add_three = function(first_value,
second_value, third_value)
return first_value + second_value +
third_value
end
print(add_three(3, 4, 5))
Example 3
function sum_diff_ratio(first_value,
second_value)
psum = first_value + second_value
pdif = first_value - second_value
prat = first_value / second_value
return psum, pdif, prat
end
sum, diff, ratio = sum_diff_ratio(2, 3)
print(sum)
print(diff)
print(ratio)
Create functions using scripts
You can use scripts to define functions. Scripts that define a function are like any other script: They
do not cause any action to be performed on the instrument until they are executed. The global
variable of the function does not exist until the script that created the function is executed.
A script can consist of one or more functions. Once a script has been run, the computer can call
functions that are in the script directly.
6-16
Series 2600B System SourceMeter® Instrument Reference Manual
Creates a variable named add_two that
has a variable type of function.
Output:
7
Creates a variable named add_three
that has a variable type of function.
Output:
12
Returns multiple parameters (sum,
difference, and ratio of the two numbers
passed to it).
Output:
5
-1
0.66666666666667
2600BS-901-01 Rev. B / May 2013

Advertisement

Table of Contents
loading

This manual is also suitable for:

2604b2614b2634b2635b2636b2602b ... Show all

Table of Contents