
19-226
Return to
2600AS-901-01 Rev. B / September 2008
Section 19: Remote Commands
Series 2600A System SourceMeter® Instruments Reference Manual
tspnet.read
Function
Reads data from a remote instrument.
TSP-Link
accessibility
This function can be accessed from a remote TSP-Link node.
Usage
value1 = tspnet.read(connection_id)
value1 = tspnet.read(connection_id, format_string)
value1, value2 = tspnet.read(connection_id, format_string)
value1, ..., valuen = tspnet.read(connection_id, format_string)
connection_id
Integer value used as a handle for other
tspnet
commands.
format_string
Format string for decoding response messages.
value1
The first value decoded from the response message.
value2
The second value decoded from the response message.
valuen
The nth value decoded from the response message. There
is one return value per format specifier in the format string.
Remarks
• This command reads available data from the remote instrument (as indicated by the format
string) and returns the number of values (as indicated by the format string).
• The format string can contain the following specifiers:
%[width]s
Read data until the specific length
%[max width]t
Read data until the specific length or delineated by punctuation
%[max width]n Read data until a new line and/or carriage return
%d
Read a number (delineated by punctuation)
• If no format is specified, the command returns a string containing the data until a new line is
reached. If no data is available, the Series 2600A will hold off operation until the requested data
is available or until a timeout error is generated. Use
tspnet.timeout
to specify the timeout
period.
• A maximum of 10 specifiers are allowed in a format string.
• When reading from a TSP-enabled remote instrument, the Series 2600A removes TSP prompts
and places any errors received from the remote instrument into its own error queue. The Series
2600A prefaces errors from the remote instrument with "Remote Error," and followed by the error
number and error description.
• Errors:
Invalid Specified Connection
Read Failed, Timeout
Read Failed, Aborted
Read Failed
Remote Error,<
remote error generated by command
>
Example
Send "*idn?" to remote instrument:
tspnet.write(id_instr, "*idn?\r\n")
Read and print response from remote instrument:
print("instrument write/read returns:: ", tspnet.read(id_instr))