From 66612f3a5fc66805375947cd810241ab51bb0565 Mon Sep 17 00:00:00 2001 From: unknown <asoalexandros@gmail.com> Date: Thu, 24 Oct 2024 17:40:35 +0200 Subject: [PATCH] Keithley 224 control class --- {TLM_messplatz => TLM_tool}/.gitkeep | 0 {TLM_messplatz => TLM_tool}/first.ipynb | 6 +- TLM_tool/keithley224.py | 143 ++++++++++++++++++++++++ keitley244/keithley_first.ipynb | 2 +- 4 files changed, 147 insertions(+), 4 deletions(-) rename {TLM_messplatz => TLM_tool}/.gitkeep (100%) rename {TLM_messplatz => TLM_tool}/first.ipynb (96%) create mode 100644 TLM_tool/keithley224.py diff --git a/TLM_messplatz/.gitkeep b/TLM_tool/.gitkeep similarity index 100% rename from TLM_messplatz/.gitkeep rename to TLM_tool/.gitkeep diff --git a/TLM_messplatz/first.ipynb b/TLM_tool/first.ipynb similarity index 96% rename from TLM_messplatz/first.ipynb rename to TLM_tool/first.ipynb index 917ea0b..994d72f 100644 --- a/TLM_messplatz/first.ipynb +++ b/TLM_tool/first.ipynb @@ -131,7 +131,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -145,9 +145,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.12.0" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/TLM_tool/keithley224.py b/TLM_tool/keithley224.py new file mode 100644 index 0000000..1775e8e --- /dev/null +++ b/TLM_tool/keithley224.py @@ -0,0 +1,143 @@ +import pyvisa + +class Keithley224(object): + """ + Control Class for the Keithley 224 + """ + def __init__(self,address="GPIB0::15::INSTR"): + """ + Parameters + ---------- + address: The GPIBO address is to be found at the I/O monitor + + Atrributes + --------- + rm: pyvisa resource manager to connect to instrument(s) + inst : an object to control the keithley 224 + + Help + --- + 1) Set instrument timeout to NONE to prevent disconnections + 2) Use control_ren for with the following codes for remote operation + + 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 + + """ + self.address = address + self.rm = pyvisa.ResourceManager() + self.inst = self.rm.open_resource(address) + self.inst.timeout = None + self.inst.control_ren(5) #local lockout blocks the tool + + def display(self,number): + """ + Change the front display panel + + Parameters + --------- + number : 0-2 + + Help + ---- + D0 = Source + D1 = Voltage limit + D2 = Dwell time + """ + self.inst.write(f"D{number}X") + + + def set_operation(self,number): + """ + Use this function for standby or operate mode + + Parameters + ---------- + Number:0(Standby) or 1(Operate) + """ + self.inst.write(f"F{number}X") + + def set_range(self,number): + """ + Sets the tool range + + Parameters + --------- + number:0 and 5-9 + + Ranges: + R0 = Auto Range (Force Most Significant number) + R5 = Full Scale: 20uA 2.0E-5 + R6 = Full Scale: 200uA 2.0E-4 + R7 = Full Scale: 2mA 2.0E-3 + R8 = Full Scale: 20mA 2.0E-2 + R9 = Full Scale : 101mA 1.01E-1 + """ + self.inst.write(f"R{number}X") + + def set_current(self,value): + """ + Sets the Current Source Output Value + + Parameters: + value: float + min -101mA + max = 101mA + """ + + sci_value = "{:.4E}".format(value) #according to tool manual for current + self.inst.write(f"I{sci_value}X") + + def set_voltage_limit(self,value): + """ + Sets the Voltage Limit(Compliance) + + Parameters + --------- + value: float + min: 1V + max : 105V + """ + sci_value= "{:.2E}".format(value) #manual format for voltage + self.inst.write(f"V{sci_value}X") + + def set_time(self,value): + """ + Sets the Dwell Time + + Parameters + ---------- + value: float + limits: 50msec to 999msec (1msec steps) + """ + sci_value = "{:.3E}".format(value) # manual format for dwell time + self.inst.write(f"W{sci_value}X") + + def __del__(self): + """ + Destructor: Disconnect Computer from Instrument + """ + self.inst.control_ren(0) # Return to local Mode see codes above + self.inst.close() + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/keitley244/keithley_first.ipynb b/keitley244/keithley_first.ipynb index e2820b6..73df83f 100644 --- a/keitley244/keithley_first.ipynb +++ b/keitley244/keithley_first.ipynb @@ -144,7 +144,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.18" + "version": "3.12.0" } }, "nbformat": 4, -- GitLab