
Section 10: Instrument programming
Series 3700A System Switch/Multimeter Reference Manual
10-66
3700AS-901-01 Rev. D/June 2018
Example script
The following example demonstrates how to connect to a remote device that is not TSP
®
enabled,
and send and receive data from this device:
-- Set tspnet timeout to 5 s.
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 the termination character to CRLF. You must do this
-- for each connection after the connection has been made.
tspnet.termination(id_instr, tspnet.TERM_CRLF)
-- Send the command string to the connected device.
tspnet.write(id_instr, "login admin\r\n")
-- Read the data available, then print it.
tspnet.write(id_instr, "*idn?\r\n")
print("instrument write/read returns: ", tspnet.read(id_instr))
-- Disconnect all existing TSP-Net sessions.
tspnet.reset()
This example produces a return such as:
ID is:
1
instrument write/read returns:
SUCCESS: Logged in
instrument write/read returns:
KEITHLEY INSTRUMENTS,MODEL
3700AS,04089762,1.6.3d
TSP-Net compared to TSP-Link to communicate with TSP-enabled
devices
The TSP-Link
®
network interface is the preferred communication method for most applications where
communication occurs between the Series 3700A and another TSP-enabled instrument.
One of the advantages of using the TSP-Link network interface is that TSP-Link connections have
three trigger lines that are available to each device on the TSP-Link network. You can use any one of
the trigger lines to perform hardware triggering between devices on the TSP-Link network. Refer to
(on page 5-31) for details.
However, if the distance between the Series 3700A and the TSP-enabled device is longer than
15 feet, use TSP-Net commands.