mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
drtio: add pulse rate example
This commit is contained in:
parent
60e748eabe
commit
c92ccd3b5b
26
artiq/examples/drtio/repository/pulse_rate.py
Normal file
26
artiq/examples/drtio/repository/pulse_rate.py
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user