1

Beating my head against the desk here- been going round and round with this Keithley2400 to take fast readings. One problem I'm having is only 10 readings come back from the system when over 100 is expected... but that's not what this Question is about...

I've coded the example from the PyVisa documents for a "more complex example" and the demo code doesn't work at all. The Keithley 2400 dies on the Sample:Count line. Infact, in the Keithley manual, this function doesn't appear. I'm writing this here so that others who are having the same problem can also commiserate.

The example code which can be found in the PyVisa documentation is as follows:

import visa rm = visa.ResourceManager() rm.list_resources() keithley = rm.open_resource('GPIB0::24::INSTR')

keithley.write("*RST; STATUS:PRESET; *CLS")

interval_in_ms = 500 number_of_readings = 10 keithley.write("STATUS:MEASUREMENT:ENABLE 512; *sre 1") keithley.write("SAMPLE:COUNT %d" % number_of_readings) keithley.write("TRIGGER:SOURCE BUS")

keithley.write("TRIGGER:DELAY %f" % (interval_in_ms / 1000.0)) keithley.write("TRACE:POINTS %d" % number_of_readings) keithley.write("TRACE:FEED SENSE1; FEED:CONTROL NEXT")

keithley.write("INITIATE")

keithley.assert_trigger()

keithley.wait_for_srq()

keithley.query("TRACE:DATA?")

voltages = keithley.query_ascii_values("TRACE:DATA?")

print("Average voltage: ", sum(voltages) / len(voltages))

keithley.query("STATUS:MEASUREMENT?")

keithley.write("TRACE:CLEAR; FEED:CONTROL NEXT")

The problem appears to occur at this line:

keithley.write("SAMPLE:COUNT %d" % number_of_readings)

which is completely unknown in the documentation and by the sourcemeter2400 unit

Current firmware is c32

Hopefully this post helps someone.

Community
  • 1
  • 1
AllenH
  • 577
  • 1
  • 4
  • 13
  • 1
    Please move your answer out of the question and into an answer. – Tom Blodget May 23 '17 at 00:48
  • @TomBlodget there's no solution in my question- perhaps it's unclear- but the example in PyVisa doesn't work at all with the Keithley due to an unkown command, namely "Sample." An answer would be either- sample was wrong, it should have been XXX or you're right, the code isn't a possible example code, PyVisa should change it either way. – AllenH May 23 '17 at 21:07

0 Answers0