examples/dds_setter: fix, scale inputs

This commit is contained in:
Sebastien Bourdeauducq 2015-10-31 23:44:09 +08:00
parent d0b5c3ba7f
commit d1ad2f1918
1 changed files with 11 additions and 3 deletions

View File

@ -6,6 +6,8 @@ from artiq import *
class DDSSetter(EnvExperiment): class DDSSetter(EnvExperiment):
"""DDS Setter""" """DDS Setter"""
def build(self): def build(self):
self.setattr_device("core")
self.dds = dict() self.dds = dict()
device_db = self.get_device_db() device_db = self.get_device_db()
@ -16,10 +18,16 @@ class DDSSetter(EnvExperiment):
and v["class"] in {"AD9858", "AD9914"}): and v["class"] in {"AD9858", "AD9914"}):
self.dds[k] = { self.dds[k] = {
"driver": self.get_device(k), "driver": self.get_device(k),
"frequency": self.get_argument("{}_frequency".format(k), "frequency": self.get_argument(
NumberValue()) "{}_frequency".format(k),
NumberValue(100e6, scale=1e6, unit="MHz", ndecimals=6))
} }
@kernel
def set_dds(self, dds, frequency):
dds.set(frequency)
delay(200*ms)
def run(self): def run(self):
for k, v in self.dds.items(): for k, v in self.dds.items():
v["driver"].set(v["frequency"]) self.set_dds(v["driver"], v["frequency"])