aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2023-06-19 20:50:36 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2023-06-19 20:50:36 -0400
commitb694f0cc161889ddc7e1cc36cace3a94803ae34b (patch)
tree7f281435b13e24db28a0c9c920ecc2ea041cc0f8 /qolab/hardware
parentbff055f21435c4df26484f0b7f3c44b7fd70da66 (diff)
downloadqolab-b694f0cc161889ddc7e1cc36cace3a94803ae34b.tar.gz
qolab-b694f0cc161889ddc7e1cc36cace3a94803ae34b.zip
better initialization and extra doc
Diffstat (limited to 'qolab/hardware')
-rw-r--r--qolab/hardware/multimeter/hp_34401.py45
1 files changed, 38 insertions, 7 deletions
diff --git a/qolab/hardware/multimeter/hp_34401.py b/qolab/hardware/multimeter/hp_34401.py
index ad11614..468e966 100644
--- a/qolab/hardware/multimeter/hp_34401.py
+++ b/qolab/hardware/multimeter/hp_34401.py
@@ -1,27 +1,58 @@
from qolab.hardware.basic import BasicInstrument
from qolab.hardware.multimeter import MultimeterSCPI
from qolab.hardware.scpi import SCPI_PROPERTY
+from pyvisa import constants as pyvisa_constants
class HP_34401(MultimeterSCPI):
""" HP 34401 multimeter (same as Agilent) """
"""
rm = pyvisa.ResourceManager()
- instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR', baud_rate = 9600)
+ instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR')
"""
- def __init__(self, resource, *args, baud_rate=9600, data_bits=8, parity=None, stop_bits=1, timeout=1, **kwds):
+ def __init__(self, resource, *args, **kwds):
super().__init__(resource, *args, **kwds)
- self.config['Device model']='hp 34401'
- # self.resource.read_termination='\n'
- self.deviceProperties.update({})
+ self.config['Device model']='HP 34401'
+ self.resource.read_termination = '\r\n'
+ self.resource.baud_rate = 9600
+ self.resource.data_bits = 8
+ self.resource.parity = pyvisa_constants.Parity.none
+ self.resource.stop_bits = pyvisa_constants.StopBits.one
+ self.deviceProperties.update({'Function'})
- measurement = SCPI_PROPERTY(scpi_prfx='SYSTem:REMote\n read', ptype=float, doc='Report current measurement', no_setter=True)
+ Function = SCPI_PROPERTY(scpi_prfx='SENSe:FUNCtion', ptype=str, doc="""
+ Current measurement function (Voltmeter DC/AC, Currentmeter DC/AC, etc.
+ Important! When assigning, string should be quoted, i.e. use:
+ Function=\'"VOLT:DC"\'
+
+ Possible values:
+ "VOLTage:DC", same as "VOLT"
+ "VOLTage:DC:RATio"
+ "VOLTage:AC"
+ "CURRent:DC", same as "CURR"
+ "CURRent:AC"
+ "RESistance" (2-wire ohms)
+ "FRESistance" (4-wire ohms)
+ "FREQuency"
+ "PERiod"
+ "CONTinuity"
+ "DIODe"
+ """
+ )
+
+ def toRemote():
+ self.write("SYSTem:REMote")
+
+ def toLocal():
+ self.write("SYSTem:LOCal")
+
+ Reading = SCPI_PROPERTY(scpi_prfx='SYSTem:REMote\n read', ptype=float, doc='Report current measurement', no_setter=True)
if __name__ == '__main__':
import pyvisa
print("testing")
rm = pyvisa.ResourceManager()
print(rm.list_resources())
- instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR', baud_rate = 9600)
+ instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR')
multimeter = HP_34401(instr)
print('------ Header start -------------')
print(str.join('\n', multimeter.getHeader()))