From 5e074f83ac333922f4b5eb16195b559085e1cef5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 2 Mar 2018 16:05:12 +0800 Subject: [PATCH] examples: update kasli sysu --- artiq/examples/kasli_sysu/idle_kernel.py | 21 --------------- .../repository/{urukul.py => demo.py} | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 artiq/examples/kasli_sysu/idle_kernel.py rename artiq/examples/kasli_sysu/repository/{urukul.py => demo.py} (62%) diff --git a/artiq/examples/kasli_sysu/idle_kernel.py b/artiq/examples/kasli_sysu/idle_kernel.py deleted file mode 100644 index 05184f731..000000000 --- a/artiq/examples/kasli_sysu/idle_kernel.py +++ /dev/null @@ -1,21 +0,0 @@ -from artiq.experiment import * - - -class IdleKernel(EnvExperiment): - def build(self): - self.setattr_device("core") - self.setattr_device("led0") - - @kernel - def run(self): - start_time = now_mu() + self.core.seconds_to_mu(500*ms) - while self.core.get_rtio_counter_mu() < start_time: - pass - self.core.reset() - while True: - self.led0.pulse(250*ms) - delay(125*ms) - self.led0.pulse(125*ms) - delay(125*ms) - self.led0.pulse(125*ms) - delay(250*ms) diff --git a/artiq/examples/kasli_sysu/repository/urukul.py b/artiq/examples/kasli_sysu/repository/demo.py similarity index 62% rename from artiq/examples/kasli_sysu/repository/urukul.py rename to artiq/examples/kasli_sysu/repository/demo.py index 39b8ea3c2..bdb3b9361 100644 --- a/artiq/examples/kasli_sysu/repository/urukul.py +++ b/artiq/examples/kasli_sysu/repository/demo.py @@ -10,13 +10,13 @@ class UrukulTest(EnvExperiment): self.setattr_device("urukul0_ch2") self.setattr_device("urukul0_ch3") self.setattr_device("led0") + self.ttl = self.get_device("ttl16") @kernel def run(self): self.core.reset() - self.led0.on() - delay(5*ms) - self.led0.off() + self.ttl.output() + delay(1*us) self.urukul0_cpld.init() self.urukul0_ch0.init() @@ -25,25 +25,28 @@ class UrukulTest(EnvExperiment): self.urukul0_ch3.init() delay(1000*us) - self.urukul0_ch0.set(100*MHz) + self.urukul0_ch0.set(10*MHz) self.urukul0_ch0.sw.on() self.urukul0_ch0.set_att(10.) delay(1000*us) - self.urukul0_ch1.set(10*MHz, 0.5) + self.urukul0_ch1.set(20*MHz, 0.5) self.urukul0_ch1.sw.on() - self.urukul0_ch1.set_att(0.) + self.urukul0_ch1.set_att(8.) delay(1000*us) - self.urukul0_ch2.set(400*MHz) + self.urukul0_ch2.set(30*MHz) self.urukul0_ch2.sw.on() - self.urukul0_ch2.set_att(0.) + self.urukul0_ch2.set_att(6.) delay(1000*us) - self.urukul0_ch3.set(1*MHz) + self.urukul0_ch3.set(40*MHz) self.urukul0_ch3.sw.on() - self.urukul0_ch3.set_att(20.) + self.urukul0_ch3.set_att(4.) while True: - self.urukul0_ch0.sw.pulse(5*ms) - delay(5*ms) + with parallel: + self.ttl.pulse(100*ms) + self.urukul0_ch0.sw.pulse(100*ms) + delay(100*ms) + self.led0.pulse(100*ms)