I am doing an experiment that requires outputting some TTL pulses after receiving each trigger pulse. This is the minimal version of the code that I am using:
for k in range(1000000):
--- try:
------ while self.ttl0.watch_stay_off():
--------- delay(3.0*us)
--- finally:
------ delay(3.0*us)
------ self.ttl0.watch_done()
------ delay(5.0 * us)
------ self.ttl5.pulse(100*ns)
With this code the delay between the trigger and the output varies between 8 to 10 us. Is there any better way to do this to have less delay and get rid of the 2 us jitter (I get underflow if reduce any delays in the code). I am aware of this question but did not understand how it was solved. Please provide a minimal code in your answer if possible.