Skip to content
Snippets Groups Projects
Commit 010a6244 authored by Alexandros Asonitis's avatar Alexandros Asonitis
Browse files

keithley class works!

parent d19a3a71
No related branches found
No related tags found
No related merge requests found
import pyvisa
class Keithley224(object):
class keithley224(object):
"""
Control Class for the Keithley 224
"""
......@@ -125,7 +125,19 @@ class Keithley224(object):
self.inst.control_ren(0) # Return to local Mode see codes above
self.inst.close()
def read_parameters(self):
"""
Sends the setted data back to the software (Without prefix) current-voltage-wait_time
"""
str_response=self.inst.query("G1X")
str_response= str_response.strip()
values = str_response.split(',')
I = float(values[0])
V = float(values[1])
W = float(values[2])
return I,V,W
......
%% Cell type:code id:29f2491b-d6fe-4d60-88f8-7c2341b404fe tags:
%% Cell type:code id:4d4cbcef-908f-4cd0-89be-790fccb51cb3 tags:
``` python
import pyvisa
import time
import keithley224_lib
k224 = keithley224_lib.keithley224()
```
%% Cell type:code id:9bd148de-3fbb-44a7-98b9-408b83f4226c tags:
%% Cell type:code id:0c6838bc tags:
``` python
rm =pyvisa.ResourceManager()
rm.list_resources()
k224= rm.open_resource('GPIB0::15::INSTR')
k224.timeout = None
k224.set_current(50e-3)
```
%% Cell type:code id:33cf3ace-54b1-44ab-8be5-5d32ea2b4ca8 tags:
%% Cell type:code id:b8ed02bc tags:
``` python
k224.write("I7.5E-2X")
k224.set_time(999e-3)
```
%% Output
%% Cell type:code id:d01b65c4 tags:
10
``` python
k224.display(0)
```
%% Cell type:code id:440d2ced-b449-4ca6-bd2d-ef7c9955a346 tags:
%% Cell type:code id:0f0ae471 tags:
``` python
k224.control_ren(3)
k224.set_operation(1)
```
%% Output
%% Cell type:code id:077207eb tags:
<StatusCode.success: 0>
``` python
k224.set_range(0)
```
%% Cell type:code id:65f1c08d-e8d6-4af6-957c-6b502bfa364c tags:
%% Cell type:code id:871f6c1c tags:
``` python
"""
VI_GPIB_REN_DEASSERT = 0
VI_GPIB_REN_ASSERT = 1
VI_GPIB_REN_DEASSERT_GTL = 2
VI_GPIB_REN_ASSERT_ADDRESS = 3
VI_GPIB_REN_ASSERT_LLO = 4
VI_GPIB_REN_ASSERT_ADDRESS_LLO = 5
VI_GPIB_REN_ADDRESS_GTL = 6
"""
# in comparison with the manual and the pyvisa constants
k224.set_voltage_limit(5)
```
%% Output
%% Cell type:code id:ae19a392 tags:
'\nVI_GPIB_REN_DEASSERT = 0\nVI_GPIB_REN_ASSERT = 1\nVI_GPIB_REN_DEASSERT_GTL = 2\nVI_GPIB_REN_ASSERT_ADDRESS = 3\nVI_GPIB_REN_ASSERT_LLO = 4\nVI_GPIB_REN_ASSERT_ADDRESS_LLO = 5\nVI_GPIB_REN_ADDRESS_GTL = 6\n'
``` python
i,v,w = k224.read_parameters()
```
%% Cell type:code id:9f123901-72cb-46ca-bff7-82336e6f5fa1 tags:
%% Cell type:code id:da3d49f4 tags:
``` python
k224.write("D0X")
print(i)
print(v)
print(w)
```
%% Output
5
0.05
5.0
0.999
%% Cell type:code id:4d4cbcef-908f-4cd0-89be-790fccb51cb3 tags:
%% Cell type:code id:80ea11ce tags:
``` python
del k224
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment