Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

Unable to read measurements from Keithley

Model 2651A
Post Reply
guitar5
Posts: 3
Joined: August 8th, 2016, 6:38 pm
Country: United States

Unable to read measurements from Keithley

Post by guitar5 » August 8th, 2016, 6:45 pm

I am trying to control my Keithley 2651A over python (using the pyvisa wrapper). I can write commands to the Keithley just fine, but always end up with the Visa Timeout Error when I try to read measurements. I'm not sure if it is just a syntax thing. I have tried a variety of commands (shown below) but always end up with the same error. The Keithley is displaying the measurements on it's display, but I am unable to retrieve the data over python.

rm = visa.ResourceManager()
rm.list_resources()
keith = rm.open_resource(u'ASRL'+str(PORT)+'::INSTR',)

keith.write('smua.reset()')
keith.write('smua.source.func = smua.OUTPUT_DCVOLTS')
keith.write('smua.source.autorangev = smua.AUTORANGE_ON')
keith.write('smua.source.levelv =' + str(VOLTAGE))
keith.write('smua.source.limiti =' + str(CURRENT))
keith.write('smua.measure.rangei =' + str(RANGE))
keith.write('smua.source.output = smua.OUTPUT_ON')
time.sleep(10)

# Commands I have tried:
# print keith.query_ascii_values('smua.measure.v(smua.nvbuffer1)')
keith.write('smua.measure.v()')
print keith.read()
# curr = (keith.query_ascii_values('printbuffer(1,'+str(1)+',smua.nvbuffer1.readings)'))
# print curr
# print keith.query('smua.measure.v()')


# Turn off output on Keithley and reset defaults
keith.write('smua.reset()')
keith.write('smua.source.output = smua.OUTPUT_OFF')
keith.write('beeper.enable = beeper.ON')
keith.write('beeper.beep(1,1200)')
keith.write('beeper.enable = beeper.OFF')

Andrea C
Keithley Applications
Keithley Applications
Posts: 1281
Joined: October 15th, 2010, 10:35 am
Country: United States
Contact:

Re: Unable to read measurements from Keithley

Post by Andrea C » August 9th, 2016, 7:18 am

You are almost there.

When you have the 2651A measure [ smua.measure.v() ] it does not automatically put the result into the nvbuffer nor into the output buffer for retrieval over the remote interface.

Either nest the print command with the measure command
keith.write('print(smua.measure.v())')
print keith.read()

Or have the measure command make use of the buffer: smua.measure.v(smua.nvbuffer1)
NOTE: you may need to add other buffer initialization commands to clear nvbuffer1, set it for append mode, enable optional timestamps, etc.

guitar5
Posts: 3
Joined: August 8th, 2016, 6:38 pm
Country: United States

Re: Unable to read measurements from Keithley

Post by guitar5 » August 9th, 2016, 10:20 am

Thanks! I tried the first method and it works.

I had one more question. Right now I am setting an arbitrary time delay in order for the Keithley to read measurements. Is there a way for the keithley to send a signal when it is done (so I will not need to hard-code a time delay)?

Thanks

Andrea C
Keithley Applications
Keithley Applications
Posts: 1281
Joined: October 15th, 2010, 10:35 am
Country: United States
Contact:

Re: Unable to read measurements from Keithley

Post by Andrea C » August 10th, 2016, 8:13 am

For the use of smua.measure.v() command, you don't really need to delay at all in your Python code.
The TSP command execution will be held off until the measurement is complete.
From Python you can send the measure command and immediately ask for the reading.
The keith.read() command will be held off until the reading is available or until the VISA timeout occurs.

Does your application require only single point measurements like this?

guitar5
Posts: 3
Joined: August 8th, 2016, 6:38 pm
Country: United States

Re: Unable to read measurements from Keithley

Post by guitar5 » August 10th, 2016, 11:48 am

I don't need a delay in my code where I take single point measurements.

However, I have another portion of my code where I run an IV sweep and am currently hardcoding a time delay:

time.sleep(15)
volt = (keith.query_ascii_values('printbuffer(1,120 ,smua.nvbuffer1.sourcevalues)'))
curr = (keith.query_ascii_values('printbuffer(1, 120, smua.nvbuffer1.readings)'))

Thanks

MarcClups
Posts: 1
Joined: October 4th, 2017, 3:39 am
Country: Spain

Re: Unable to read measurements from Keithley

Post by MarcClups » October 4th, 2017, 3:41 am

Did you find out how to do it? I'm having the same problem right now. Thanks.

Post Reply

Return to “2651A High Current SourceMeter”

Who is online

Users browsing this forum: No registered users and 2 guests