![background image](http://html2.mh-extra.com/html/keithley/2657a/2657a_reference-manual_4007750312.webp)
Model 2657A High Power System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2657A-901-01 Rev. B/December 2012
6-63
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:
-- 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")
-- 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, "*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()
Remote instrument errors
If the Model 2657A is connected to a TSP-enabled instrument through TSP-Net, all errors that occur
on the remote instrument are transferred to the error queue of the Model 2657A. The Model 2657A
indicates errors from the remote instrument by prefacing these errors with “Remote Error.” For
example, if the remote instrument generates error code 4909, "Reading buffer not found within
device," the Model 2657A generates the error string “Remote Error: (4909) Reading buffer not found
within device.”
TSP-Net instrument commands: General device control
The following instrument commands provide general device control:
(on page 7-358)
(on page 7-359)
(on page 7-360)
(on page 7-361)
(on page 7-363)
(on page 7-364)
(on page 7-364)
(on page 7-365)
(on page 7-368)
Содержание 2657A
Страница 3: ......