Example Script; Using Tsp-Net Vs. Tsp-Link For Communication With Tsp-Enabled Devices - Keithley 2600a series Reference Manual

Sourcemeter
Table of Contents

Advertisement

Series 2600A System SourceMeter® Instruments Reference Manual
NOTE Set
3.
Use
tspnet.write
needed termination characters or other lines. Use
termination character. If you use
termination characters to all strings sent to the command.
4.
Retrieve responses from the remote device using tspnet.read. The Series 2600A
suspends operation until data is available or a timeout error is generated. You can check if
data is available from the remote device using tspnet.readavailable.
Disconnect from the remote device using tspnet.disconnect. Terminate all remote
connections using tspnet.reset.

Example script

The following example demonstrates how to connect to a remote non-TSP
send and receive data from this device:
-- Disconnect all existing TSP-NetTM connections.
tspnet.reset()
-- Set tspnet timeout to 5 seconds.
tspnet.timeout = 5
-- Establish connection to another device with IP address 192.168.1.51
-- at port 1394.
id_instr = tspnet.connect("192.168.1.51",1394, "*rst\r\n")
-- Print the device ID from connect string.
print("ID is: ", id_instr)
-- Set termination character to CRLF. You must do this on a per
-- connection basis after connection has been made.
tspnet.termination(id_instr, tspnet.TERM_CRLF)
-- Send the command string to the connected device.
tspnet.write(id_instr,"*idn?" .. "\r\n")
-- Read the data available, then print it.
print("instrument write/read returns:: " , tspnet.read(id_instr))
-- Disconnect all existing TSP-Net sessions.
tspnet.reset()

Using TSP-Net vs. TSP-Link for communication with TSP-enabled devices

TSP Link is the preferred communication method when communicating between the Series 2600A
and another TSP
Net, including:
Error checking: When connected to a TSP-enabled device, all errors that occur on the
remote device are transferred to the error queue of the Series 2600A. The Series 2600A
indicates errors from the remote device by prefacing these errors with "Remote Error".
Digital I/O Triggering: TSP Link connections have three TSP synchronization lines that are
available to each device on the TSP Link network. You can use any one of the TSP
synchronization lines to perform hardware triggering between devices on the TSP Link
network.
2600AS-901-01 Rev. B / September 2008
tspnet.tsp.abortonconnect
currently running on a remote TSP device.
or
tspnet.write
tspnet.execute
sends strings to the device exactly as indicated, and you must supply any
TM
-enabled instrument. Using TSP Link has certain advantages over using TSP-
Return to
Section Topics
to TRUE to abort any script
to send strings to a remote device. Using
tspnet.termination
instead, the Series 2600A appends
tspnet.execute
Section 18: TSP-NetTM
to specify the
TM
-enabled device, and
18-3

Advertisement

Table of Contents
loading

Table of Contents