From f5a5b7a22ae734db852f11ebf19516150aedfe04 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 23 Nov 2021 16:41:29 +0800 Subject: [PATCH] examples: add nac3devices --- artiq/examples/nac3devices/nac3devices.json | 20 +++++++++++ artiq/examples/nac3devices/nac3devices.py | 37 +++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 artiq/examples/nac3devices/nac3devices.json create mode 100644 artiq/examples/nac3devices/nac3devices.py diff --git a/artiq/examples/nac3devices/nac3devices.json b/artiq/examples/nac3devices/nac3devices.json new file mode 100644 index 000000000..bd8d9043a --- /dev/null +++ b/artiq/examples/nac3devices/nac3devices.json @@ -0,0 +1,20 @@ +{ + "target": "kasli", + "min_artiq_version": "8.0", + "variant": "nac3devices", + "hw_rev": "v1.1", + "base": "standalone", + "core_addr": "192.168.1.70", + "peripherals": [ + { + "type": "zotino", + "ports": [0] + }, + { + "type": "urukul", + "dds": "ad9912", + "ports": [2, 3], + "clk_sel": 2 + } + ] +} diff --git a/artiq/examples/nac3devices/nac3devices.py b/artiq/examples/nac3devices/nac3devices.py new file mode 100644 index 000000000..70d8eec6a --- /dev/null +++ b/artiq/examples/nac3devices/nac3devices.py @@ -0,0 +1,37 @@ +from artiq.experiment import * +from artiq.coredevice.core import Core +from artiq.coredevice.zotino import Zotino +from artiq.coredevice.urukul import CPLD +from artiq.coredevice.ad9912 import AD9912 + +@nac3 +class NAC3Devices(EnvExperiment): + core: KernelInvariant[Core] + zotino0: KernelInvariant[Zotino] + urukul0_cpld: KernelInvariant[CPLD] + urukul0_ch0: KernelInvariant[AD9912] + + def build(self): + self.setattr_device("core") + self.setattr_device("zotino0") + self.setattr_device("urukul0_cpld") + self.setattr_device("urukul0_ch0") + + @kernel + def run(self): + self.core.reset() + self.core.delay(1.*ms) + self.zotino0.init(False) + self.zotino0.set_leds(0x15) + self.core.delay(1.*ms) + self.zotino0.set_dac([1.2, -5.3, 3.4, 4.5], [0, 1, 2, 3]) + + self.core.break_realtime() + self.core.delay(1.*ms) + self.urukul0_cpld.init(False) + self.urukul0_ch0.init() + self.urukul0_ch0.sw.on() + for i in range(10): + self.urukul0_ch0.set((10. + float(i))*MHz) + self.urukul0_ch0.set_att(6.) + self.core.delay(500.*ms)