2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-28 20:53:35 +08:00

examples: add RTIO demo

This commit is contained in:
Sebastien Bourdeauducq 2014-07-20 18:38:10 -06:00
parent c5dba6c3b8
commit 9b5c28af82

32
examples/ttl_test.py Normal file
View File

@ -0,0 +1,32 @@
from artiq.language.units import *
from artiq.language.core import *
from artiq.devices import corecom_serial, core, ttl_core
class TTLTest(MPO):
parameters = "a b c d"
@kernel
def run(self):
delay(10*us)
i = 0
while i < 100000:
with parallel:
with sequential:
self.a.pulse(50*us)
self.b.pulse(50*us)
with sequential:
self.c.pulse(10*us)
self.d.pulse(20*us)
i += 1
if __name__ == "__main__":
with corecom_serial.CoreCom() as com:
coredev = core.Core(com)
exp = TTLTest(
core=coredev,
a=ttl_core.TTLOut(core=coredev, channel=0),
b=ttl_core.TTLOut(core=coredev, channel=1),
c=ttl_core.TTLOut(core=coredev, channel=2),
d=ttl_core.TTLOut(core=coredev, channel=3),
)
exp.run()