Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion qcodes/instrument_drivers/Harvard/Decadac.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ def __init__(self, parent, name, channel, min_val=-5, max_val=5):
# Note we will use the older addresses to read the value from the dac
# rather than the newer 'd' command for backwards compatibility
self._volt_val = vals.Numbers(self.min_val, self.max_val)
self.add_parameter("fine_volt",
get_cmd=self._get_fine_voltage,
set_cmd=self._set_fine_voltage,
label="Voltage", unit="V"
)
self.add_parameter("volt", get_cmd=partial(self._query_address,
self._base_addr+9, 1),
get_parser=self._dac_code_to_v,
Expand Down Expand Up @@ -265,6 +270,37 @@ def __init__(self, parent, name, channel, min_val=-5, max_val=5):
set_parser=self._dac_v_to_code,
vals=vals.Numbers(self.min_val, self.max_val))

def _get_fine_voltage(self):
slot = self._parent
if slot.slot_mode.get_latest() not in ['Fine', 'FineCald']:
raise RuntimeError("Cannot get fine voltage unless slot in Fine mode")
if self._channel == 0:
fine_chan = 2
elif self._channel == 1:
fine_chan = 3
else:
raise RuntimeError("Fine mode only works for Chan 0 and 1")
return self.volt.get() + (slot.channels[fine_chan].volt.get()+10)/200

def _set_fine_voltage(self, voltage):
slot = self._parent
if slot.slot_mode.get_latest() not in ['Fine', 'FineCald']:
raise RuntimeError("Cannot get fine voltage unless slot in Fine mode")
if self._channel == 0:
fine_chan = 2
elif self._channel == 1:
fine_chan = 3
else:
raise RuntimeError("Fine mode only works for Chan 0 and 1")
coarse_part = self._dac_code_to_v(self._dac_v_to_code(voltage-0.001))

fine_part = voltage - coarse_part
fine_scaled = fine_part*200-10
print("trying to set to {}, by setting coarse {} and fine {} with total {}".format(voltage,
coarse_part, fine_scaled, coarse_part+fine_part))
self.volt.set(coarse_part)
slot.channels[fine_chan].volt.set(fine_scaled)

def _ramp(self, val, rate, block=True):
"""
Ramp the DAC to a given voltage.
Expand Down Expand Up @@ -383,7 +419,7 @@ def __init__(self, parent, name, slot, min_val=-5, max_val=5):
val_mapping=slot_modes)

# Enable all slots in coarse mode.
self.slot_mode.set(self.SLOT_MODE_DEFAULT)
self.slot_mode.set("Fine")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI that this change will cause issues for us on our experiments.

Perhaps we should add an unknown state that is set when the instrument is initialized, given that there is no (known) way of reading out this value?

Copy link
Copy Markdown
Collaborator Author

@jenshnielsen jenshnielsen Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spauka I know, this is not meant to go in in the current format (hence the [WIP] tag)

Did you see my notification on Slack, If you are using the Decadac driver and do ramping by setting delay and step as in the tutorial here https://github.com/QCoDeS/Qcodes/blob/master/docs/examples/Tutorial.ipynb
it will most likely jump to wrong value at the beginning of the ramp. Affected QCoDeS master is between the 16th of October and Yesterday

This does not affect you if you use the ramping built into the decadac driver.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, sounds good :) Thought it worth mentioning the possible solution of setting an unknown state, I hadn't been using delays/steps so this hasn't affected me as yet, but will keep this in mind.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thanks for bringing it up. Better safe than sorry


def write(self, cmd):
"""
Expand Down