From ff2d6da50d0905549074b51852a0c2a44ba1d696 Mon Sep 17 00:00:00 2001 From: William Nielsen Date: Thu, 30 Mar 2017 15:26:45 +0200 Subject: [PATCH 1/2] fix: Respond to issue #546 Unfortunately not tested. Should fix #546 --- qcodes/instrument_drivers/Harvard/Decadac.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/qcodes/instrument_drivers/Harvard/Decadac.py b/qcodes/instrument_drivers/Harvard/Decadac.py index 0c3ef178749e..25e6c17ef277 100644 --- a/qcodes/instrument_drivers/Harvard/Decadac.py +++ b/qcodes/instrument_drivers/Harvard/Decadac.py @@ -90,15 +90,23 @@ def __init__(self, name, port, slot, timeout=2, baudrate=9600, self.add_parameter('mode', label='Output mode', - set_cmd='B {}; M {};'.format(self.slot, '{}'), - vals=vals.Enum(0, 1), + set_cmd=partial(self._setmode, self.slot), + vals=vals.Enum(0, 1, 2), docstring=""" The operational mode of the slot. - 0: output off, 1: output on. + 0: output off, 1: high res mode, + 2: 4-channel (low res) mode. """) # initialise hardware settings - self.mode.set(1) + self.mode.set(2) + + def _setmode(slot, mode): + """ + set_cmd for the mode parameter + """ + self.visa_handle.write('B {}; M {};'.format(slot, mode) + self.visa_handle.read() def _getoffset(self, n): return self._offsets[n] @@ -256,4 +264,3 @@ def _voltage2code(self, voltage, channel): 3: lambda x: 2**16/10*(x-2**-16+10)} voltage_float = translationdict[self._voltranges[channel]](voltage) return str(int(voltage_float)) - From b47868347d59233f8dfb4d68ce2439ce9bddcea7 Mon Sep 17 00:00:00 2001 From: William Nielsen Date: Thu, 30 Mar 2017 17:03:12 +0200 Subject: [PATCH 2/2] fix: Remove fine mode Remove the high res mode --- qcodes/instrument_drivers/Harvard/Decadac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qcodes/instrument_drivers/Harvard/Decadac.py b/qcodes/instrument_drivers/Harvard/Decadac.py index 25e6c17ef277..edf987ea4b4c 100644 --- a/qcodes/instrument_drivers/Harvard/Decadac.py +++ b/qcodes/instrument_drivers/Harvard/Decadac.py @@ -91,10 +91,10 @@ def __init__(self, name, port, slot, timeout=2, baudrate=9600, self.add_parameter('mode', label='Output mode', set_cmd=partial(self._setmode, self.slot), - vals=vals.Enum(0, 1, 2), + vals=vals.Enum(0, 2), docstring=""" The operational mode of the slot. - 0: output off, 1: high res mode, + 0: output off, 2: 4-channel (low res) mode. """)