Series 2600 System SourceMeters Reference Manual TSP Programming Fundamentals 2-7
Return to Section 2 topics 2600S-901-01 Rev. A / May 2006
Programming overview
What is a chunk?
A chunk is a single programming statement or a sequence of statements that are
executed sequentially. There are non-scripted chunks and scripted chunks.
Single statement chunk – The following programming statement is a chunk:
print ("This is a chunk")
When the above chunk is executed, it returns the following string:
This is a chunk
Multiple statement chunk – A chunk can also contain multiple statements. Each
statement in the line of code is to be separated by whitespace. The following
chunk contains two statements:
print ("This is a chunk") print ("that has two statements")
When the above chunk is executed, the two statements are executed sequentially
and the following strings are returned:
This is a chunk
that has two statements
Multiple chunks – The following two lines of code are two chunks. The first chunk
sets the source level of SMU A to 1V and the second chunk turns the output on.
smua.source.levelv = 1
smua.source.output = smua.OUTPUT_ON
Scripted chunk – In a script environment, the chunk is the entire listing of test
programming code. If the two statements in the above example were created as a
script, then those two lines of code would be considered one chunk. See the topic
below, “
What is a script?”
What is a script?
The Series 2600 utilizes a Test Script Processor (TSP) to process and run
individual chunks or programs called scripts. A script is a collection of instrument
control commands and programming statements.
Figure 2-1 shows an example of
how to create (and load) a script named “test.” When this script is run, the
message “This is a test” will be displayed on the Series 2600 and sent to the PC.
As shown, a script is made up of a chunk of programming code that is framed by
shell commands. The first shell command in
Figure 2-1 loads the script named
“test.” The last shell command marks the end of the script.
The chunk in Figure 2-1 consists of three lines of code. When the chunk is
executed, the test messages will be sent and displayed. The following command
executes the chunk:
test()