-
Notifications
You must be signed in to change notification settings - Fork 0
/
Keithley_2612_B_System_source_meter.py
57 lines (35 loc) · 1.57 KB
/
Keithley_2612_B_System_source_meter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pyvisa as visa
class Keithley2612BController:
def __init__(self, ip_address):
self.keithley = visa.ResourceManager().open_resource(f"TCPIP0::{ip_address}::5025::SOCKET")
def reset(self):
self.keithley.write("smua.reset()")
def set_source_function(self, function):
self.keithley.write(f"smua.source.func=smua.{function}")
def set_source_voltage(self, voltage):
self.keithley.write(f"smua.source.levelv={voltage}")
def set_source_voltage_range(self, voltage_range):
self.keithley.write(f"smua.source.rangev={voltage_range}")
def set_source_current_limit(self, current_limit):
self.keithley.write(f"smua.source.limiti={current_limit}")
def set_measurement_current_range(self, current_range):
self.keithley.write(f"smua.measure.rangei={current_range}")
def enable_source_output(self):
self.keithley.write("smua.source.output=smua.OUTPUT_ON")
def disable_source_output(self):
self.keithley.write("smua.source.output=smua.OUTPUT_OFF")
def measure_current(self):
return self.keithley.ask("smua.measure.i()")
# In[7]:
k2612B = Keithley2612BController("169.254.000.001")
k2612B.reset()
k2612B.set_source_function("OUTPUT_DCVOLTS")
k2612B.set_source_voltage_range(20)
k2612B.set_source_voltage(5)
k2612B.set_source_current_limit(10e-3)
k2612B.set_measurement_current_range(10e-3)
k2612B.enable_source_output()
current = k2612B.measure_current()
k2612B.disable_source_output()
k2612B.reset()
# In[ ]: