forked from M-Labs/artiq
1
0
Fork 0

examples: update kasli sysu

This commit is contained in:
Sebastien Bourdeauducq 2018-03-02 16:05:12 +08:00
parent 29d42f4648
commit 5e074f83ac
2 changed files with 15 additions and 33 deletions

View File

@ -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)

View File

@ -10,13 +10,13 @@ class UrukulTest(EnvExperiment):
self.setattr_device("urukul0_ch2") self.setattr_device("urukul0_ch2")
self.setattr_device("urukul0_ch3") self.setattr_device("urukul0_ch3")
self.setattr_device("led0") self.setattr_device("led0")
self.ttl = self.get_device("ttl16")
@kernel @kernel
def run(self): def run(self):
self.core.reset() self.core.reset()
self.led0.on() self.ttl.output()
delay(5*ms) delay(1*us)
self.led0.off()
self.urukul0_cpld.init() self.urukul0_cpld.init()
self.urukul0_ch0.init() self.urukul0_ch0.init()
@ -25,25 +25,28 @@ class UrukulTest(EnvExperiment):
self.urukul0_ch3.init() self.urukul0_ch3.init()
delay(1000*us) delay(1000*us)
self.urukul0_ch0.set(100*MHz) self.urukul0_ch0.set(10*MHz)
self.urukul0_ch0.sw.on() self.urukul0_ch0.sw.on()
self.urukul0_ch0.set_att(10.) self.urukul0_ch0.set_att(10.)
delay(1000*us) 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.sw.on()
self.urukul0_ch1.set_att(0.) self.urukul0_ch1.set_att(8.)
delay(1000*us) delay(1000*us)
self.urukul0_ch2.set(400*MHz) self.urukul0_ch2.set(30*MHz)
self.urukul0_ch2.sw.on() self.urukul0_ch2.sw.on()
self.urukul0_ch2.set_att(0.) self.urukul0_ch2.set_att(6.)
delay(1000*us) delay(1000*us)
self.urukul0_ch3.set(1*MHz) self.urukul0_ch3.set(40*MHz)
self.urukul0_ch3.sw.on() self.urukul0_ch3.sw.on()
self.urukul0_ch3.set_att(20.) self.urukul0_ch3.set_att(4.)
while True: while True:
self.urukul0_ch0.sw.pulse(5*ms) with parallel:
delay(5*ms) self.ttl.pulse(100*ms)
self.urukul0_ch0.sw.pulse(100*ms)
delay(100*ms)
self.led0.pulse(100*ms)