From c92ccd3b5bce76c908cbab820083aa9de8149220 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 9 Nov 2016 15:29:15 +0800 Subject: [PATCH] drtio: add pulse rate example --- artiq/examples/drtio/repository/pulse_rate.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 artiq/examples/drtio/repository/pulse_rate.py diff --git a/artiq/examples/drtio/repository/pulse_rate.py b/artiq/examples/drtio/repository/pulse_rate.py new file mode 100644 index 000000000..091a30786 --- /dev/null +++ b/artiq/examples/drtio/repository/pulse_rate.py @@ -0,0 +1,26 @@ +from artiq.experiment import * + + +class PulseRate(EnvExperiment): + def build(self): + self.setattr_device("core") + self.setattr_device("rsmap") + + @kernel + def run(self): + #self.core.reset() + self.core.break_realtime() + + dt = seconds_to_mu(300*ns) + while True: + for i in range(10000): + try: + self.rsmap.pulse_mu(dt) + delay_mu(dt) + except RTIOUnderflow: + dt += 1 + self.core.break_realtime() + break + else: + print(mu_to_seconds(dt)) + return