forked from M-Labs/artiq
Sebastien Bourdeauducq
2a843ea436
This allows specifying default values for parameters, and other data.
35 lines
974 B
Python
35 lines
974 B
Python
from artiq import *
|
|
from artiq.coredevice import comm_serial, core, rtio
|
|
from artiq.coredevice.runtime_exceptions import RTIOUnderflow
|
|
|
|
|
|
def print_min_period(p):
|
|
print("Minimum square wave output period: {} ns".format(p))
|
|
|
|
|
|
class PulsePerformance(AutoContext):
|
|
o = Device("ttl_out")
|
|
|
|
@kernel
|
|
def run(self):
|
|
T = time_to_cycles(100*ns)
|
|
while True:
|
|
try:
|
|
for i in range(1000):
|
|
self.o.pulse(cycles_to_time(T))
|
|
delay(cycles_to_time(T))
|
|
except RTIOUnderflow:
|
|
T += 1
|
|
self.core.recover_underflow()
|
|
else:
|
|
print_min_period(int(cycles_to_time(2*T)/(1*ns)))
|
|
break
|
|
|
|
|
|
if __name__ == "__main__":
|
|
with comm_serial.Comm() as comm:
|
|
coredev = core.Core(comm)
|
|
exp = PulsePerformance(core=coredev,
|
|
o=rtio.RTIOOut(core=coredev, channel=2))
|
|
exp.run()
|