Models 707B and 708B Switching Matrix Reference Manual
Section 6: Instrument programming
707B-901-01 Rev. B / January 2015
6-53
Using TSP-Net with any Ethernet-enabled device
Refer to TSP commands for more details about the commands presented in this section.
To communicate to a remote ethernet-enabled device from the Model 707B or 708B, perform the
following steps:
1. Connect to the remote device through the LAN port. If you are connecting:
Directly from the Model 707B or 708B to an ethernet-enabled device: Use an ethernet
crossover cable.
The Model 707B or 708B to any other device on the LAN: Use a straight-through ethernet
cable and a hub.
2. Establish a new connection to a remote device at a specific IP address using
tspnet.connect()
.
3. If the device is not TSP-enabled, you must also provide the port number. If not, the Model 707B
or 708B assumes the remote device is TSP-enabled and enables TSP prompts and error
handling.
If the Model 707B or 708B is not able to make a connection to the remote device, it generates a
timeout error. Use
tspnet.timeout
to set the timeout value. The default timeout value is 20
seconds.
Set
tspnet.tsp.abortonconnect
to 1 to abort any script currently running on a remote TSP
device.
4. Use
tspnet.write()
or
tspnet.execute()
to send strings to a remote device.
tspnet.write()
sends strings to the device exactly as indicated, and you must supply any
needed termination characters or other lines. Use
tspnet.termination()
to specify the
termination character. If you use
tspnet.execute()
(on page 7-231) instead, the Model 707B
or 708B appends termination characters to all strings sent to the command.
5. Retrieve responses from the remote device using
tspnet.read()
. The Model 707B or 708B
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 device that is not Test Script
Processor (TSP
®
) enabled, and send and receive data from this device:
-- Disconnect all existing TSP-Net 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")