
2600AS-901-01 Rev. B / September 2008
Return to
19-93
Series 2600A System SourceMeter® Instruments Reference Manual
Section 19: Remote Commands
makegetter and makesetter
These functions are used create functions that set and retrieve the value of an attribute.
makegetter
Function
Creates a function to set the value of an attribute.
TSP-Link
accessibility
This function cannot be accessed from a remote TSP-Link node.
Usage
getter = makegetter(table, attributename)
table
Read-only table were the attribute is located.
attributename
The string name of the attribute.
getter
Function that returns the value of the attribute.
Remarks
• This function creates a function that when called returns the value of the attribute. This function
is useful for aliasing attributes to improve execution speed. Calling the
getter
function will
execute faster than accessing the attribute directly.
• Creating a
getter
function is only useful if it is going to be called several times.
Otherwise the overhead of creating the
getter
function outweighs the overhead of accessing
the attribute directly.
Example
Creates a getter function called
getlevel
:
getlevel = makegetter(smua.source, "levelv")
...
v = getlevel()
When
getlevel
is called, it returns the value of
smua.source.levelv
.
makesetter
Function
Creates a function to set the value of an attribute.
TSP-Link
accessibility
This function cannot be accessed from a remote TSP-Link node.
Usage
setter = makesetter(table, attributename)
table
Read-only table where the attribute is located.
attributename
The string name of the attribute.
setter
Function that sets the value of the attribute.
Remarks
• This function creates a function that when called sets the value of the attribute. This function is
useful for aliasing attributes to improve execution speed. Calling the
setter
function will execute faster than accessing the attribute directly.
• Creating a
setter
function is only useful if it is going to be called several times.
Otherwise the overhead of creating the
setter
function outweighs the overhead of accessing
the attribute directly.
Example
Creates a
setter
function called
setlevel
:
setlevel = makesetter(smua.source, "levelv")
for v = 1, 10 do
setlevel(v)
end
Using
setlevel
in the loop sets the value of
smua.source.levelv
, thereby
performing a source sweep.