forked from M-Labs/artiq
1
0
Fork 0
artiq/examples/rtio_skew.py

32 lines
640 B
Python
Raw Normal View History

2014-10-14 15:54:28 +08:00
from artiq import *
2015-01-30 19:07:51 +08:00
class PulseNotReceived(Exception):
pass
2014-10-14 15:54:28 +08:00
class RTIOSkew(AutoDB):
class DBKeys:
pmt0 = Device()
ttl0 = Device()
2015-01-29 23:49:17 +08:00
io_skew = Result()
2014-10-14 15:54:28 +08:00
2015-01-30 19:07:51 +08:00
@staticmethod
def realtime_results():
return {
"io_skew": "raw"
}
2014-10-14 15:54:28 +08:00
@kernel
def run(self):
with parallel:
2014-12-03 18:20:30 +08:00
self.pmt0.gate_rising(10*us)
2014-10-14 15:54:28 +08:00
with sequential:
delay(5*us)
out_t = now()
2014-12-03 18:20:30 +08:00
self.ttl0.pulse(5*us)
in_t = self.pmt0.timestamp()
2014-10-14 15:54:28 +08:00
if in_t < 0*s:
2015-01-30 19:07:51 +08:00
raise PulseNotReceived
self.io_skew = out_t - in_t