Newer
Older
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import equipment
import pyvisa
import time
import numpy as np
class K4200(equipment.Equipment):
"""Class to control HP4145 semiconductor analyzer"""
model="K4200"
company="Keysight"
link="https://www.tek.com/en/products/keithley/4200a-scs-parameter-analyzer"
def initialize_sweep(self, mode="voltage sweep",number_channel=4,smu_bias={"SMU2":0,"SMU3":0,"SMU4":0},
smu_compliance={"SMU1":1e-6,"SMU2":1e-6,"SMU3":1e-6,"SMU4":1e-6},sweep_param={"start":0,"stop":0,"step":0},
integration_mode="IT1",delay_time=0,hold_time=0):
"""
mode:
- "voltage sweep": voltage sweep with SMU1 and current measurements on all the SMUs
"""
self.mode=mode
self.number_channel=number_channel
self.sweep_param=sweep_param
self.smu_compliance=smu_compliance
self.smu_bias=smu_bias
self.integration_mode=integration_mode
self.delay_time=delay_time
self.hold_time=hold_time
self.set_connection_parameter_dic({"timeout":10e3,"write_termination":'\r\n',"read_termination":'\r\n',"send_end":True})
try:
self.pyvisa_resource.write("BC") # clear all buffer.
self.pyvisa_resource.write("DR1") # This command enables or disables service request for data ready when communications is set to GPIB.
self.pyvisa_resource.write("EC 1") # This command sets the condition to exit the test if compliance is reached.
if mode =="voltage sweep":
self.length_data=int(abs((sweep_param["stop"]-sweep_param["start"])/sweep_param["step"]))
self.pyvisa_resource.write("DE") # DE: Accesses SMU channel definition page.
self.pyvisa_resource.write("CH1, 'V1', 'I1', 1, 1") # 1/2/3: voltage/current/Common 1/2/3: VAR1/VAR2/constant
for i in range(number_channel-1):
self.pyvisa_resource.write("CH%d, 'V%d', 'I%d', 1, 3"%(i+2,i+2,i+2))
self.pyvisa_resource.write("SS")# Accesses source setup page
self.pyvisa_resource.write("VR1, %s, %s, %s, %s"%(sweep_param["start"],sweep_param["stop"],sweep_param["step"],sweep_param["compliance"])) # VR1 for linear sweep of VAR1 source function, vmin, vmax,vstep, compliance
self.pyvisa_resource.write("VC2, %.2f, %s"%(smu_bias[0],smu_compliance[0]))
self.pyvisa_resource.write("VC3, %.2f, %s"%(smu_bias[1],smu_compliance[1]))
self.pyvisa_resource.write("VC4, %.2f, %s"%(smu_bias[2],smu_compliance[2]))
self.pyvisa_resource.write("HT %f"%hold_time) # Sets a hold time that delays the start of a sweep
self.pyvisa_resource.write("DT %f"%delay_time) # delay time: Sets the time to wait between when the output voltage is set and when the measurement is made in a sweep.
self.pyvisa_resource.write(integration_mode) # integration time, IT1/IT2/IT3 : short/medium/long
self.pyvisa_resource.write("RS 7") # This command sets the measurement resolution for all channels of a SM in number of bits
self.pyvisa_resource.write("RG 1, 10E-12") # This command sets the measurement resolution for all channels of a SM in number of bits
self.pyvisa_resource.write("RG 2, 10E-12") # This command sets the lowest current range of the SMU to be used when measuring.
self.pyvisa_resource.write("SM")
self.pyvisa_resource.write("DM2")
self.pyvisa_resource.write("LI 'I1','I2','I3','I4'")
except pyvisa.VisaIOError:
print("/!\ VisaIOError : timeout expired")
self.pyvisa_resource.close()
return {"mode":mode, "number_channels":number_channel, "sweep_param":sweep_param}
def launch_measurements(self):
self.pyvisa_resource.write("MD") # This command controls measurements.
self.pyvisa_resource.write("ME1") # Run a single trigger test and store readings in a cleared buffer: 1
time.sleep(10)
N=self.length_data
if self.mode=="voltage sweep":
v_list=np.round(np.arange(self.sweep_param["start"],self.sweep_param["stop"]+self.sweep_param["step"],self.sweep_param["step"]),6)
data=np.zeros((N,self.number_channel))
data[:,0]=v_list
count=0
while (count<N):
data_ch1=np.float32(self.pyvisa_resource.query("RD 'I1', %d"%(count+1)))
if (data_ch1!=0.):
data[count,1]=data_ch1
for i in range(self.number_channel-1):
data[count,i+2]=np.float32(self.pyvisa_resource.query("RD 'I%d', %d"%(i+2,count+1)))
count+=1
time.sleep(0.1)
return data