EasyManua.ls Logo

Keithley 2651A

Keithley 2651A
800 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Section 6: Instrument programming Model 2651A High Power System SourceMeter® Instrument Reference Manual
6-64 2651A-901-01 Rev. A / March 2011
Example: Using tspnet commands
function telnetConnect(ipAddress, userName, password)
-- Connect through telnet to a computer
id = tspnet.connect(ipAddress, 23, "")
-- Read the title and login prompt from the computer
print(string.format("from computer--> (%s)", tspnet.read(id, "%n")))
print(string.format("from computer--> (%s)", tspnet.read(id, "%s")))
-- Send the login name
tspnet.write(id, userName .. "\r\n")
-- Read the login echo and password prompt from the computer
print(string.format("from computer--> (%s)", tspnet.read(id, "%s")))
-- Send the password information
tspnet.write(id, password .. "\r\n")
-- Read the telnet banner from the computer
print(string.format("from computer--> (%s)", tspnet.read(id, "%n")))
print(string.format("from computer--> (%s)", tspnet.read(id, "%n")))
print(string.format("from computer--> (%s)", tspnet.read(id, "%n")))
print(string.format("from computer--> (%s)", tspnet.read(id, "%n")))
end
function test_tspnet ()
tspnet.reset()
-- Connect to a computer via telnet
telnetConnect("192.0.2.1", "my_username", "my_password")
-- Read the prompt back from the computer
print(string.format("from computer--> (%s)", tspnet.read(id, "%n")))
-- Change directory and read the prompt back from the computer
tspnet.write(id, "cd c:\\\r\n")
print(string.format("from computer--> (%s)", tspnet.read(id, "%s")))
-- Make a directory and read the prompt back from the computer
tspnet.write(id, "mkdir TEST_TSP\r\n")
print(string.format("from computer--> (%s)", tspnet.read(id, "%s")))
-- Change to the newly created directory
tspnet.write(id, "cd c:\\TEST_TSP\r\n")
print(string.format("from computer--> (%s)", tspnet.read(id, "%s")))
-- if you have a data print it to the file
-- 11.2 is an example of data collected
cmd = "echo " .. string.format("%g", 11.2) .. " >> datafile.dat\r\n"
tspnet.write(id, cmd)
print(string.format("from computer--> (%s)", tspnet.read(id, "%s")))
tspnet.disconnect(id)
end
test_tspnet()

Table of Contents

Other manuals for Keithley 2651A

Related product manuals