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
Unable to read measurements from Keithley
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')
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')
-
- Keithley Applications
- Posts: 1263
- Joined: October 15th, 2010, 10:35 am
- Country: United States
- Contact:
Re: Unable to read measurements from Keithley
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.
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.
Re: Unable to read measurements from Keithley
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
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
-
- Keithley Applications
- Posts: 1263
- Joined: October 15th, 2010, 10:35 am
- Country: United States
- Contact:
Re: Unable to read measurements from Keithley
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?
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?
Re: Unable to read measurements from Keithley
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
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
Re: Unable to read measurements from Keithley
Did you find out how to do it? I'm having the same problem right now. Thanks.
Who is online
Users browsing this forum: No registered users and 2 guests