-- 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
2600B,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 2600B 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
Hardware trigger modes (on page 4-30) for details.
However, if the distance between the 2600B and the TSP-enabled device is longer than 15 feet, use
TSP-Net commands.