User manual
Series 3700 System Switch/Multimeter Reference Manual Section 10: TSP-Net
3700S-901-01 Rev. C / July 2008 10-3
Example script
The following example demonstrates how to connect to a remote non-TSP
TM
-
enabled device, and send and receive data from this device:
-- Disconnect all existing TSP-Net
TM
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 prints it.
print("instrument write/read returns:: " ,
tspnet.read(id_instr))
-- Disconnect all existing TSP-Net sessions.
tspnet.reset()