I want to build an experiment, that waits for a trigger signal on a TTL input port (Port 1) (possibly up to a certain maximum time), executes as soon as possible, when the trigger is received on the TTL and then counts TTL events on another TTL input port (Port 2).
The two possible ways I found are the following:
1) Open a gate for 60 seconds on port 1 and wait for the timestamp of the trigger. If the timestamp is received, continue with the experiment and try to receive TTL signals on port 2. This runs into the issue, that apparently the port 1 gate time has to finish, before the port 2 gate can be opened. Up until this point execution runs fine. Is there a way to either close port 1 manually once a timestamp has been received, or to run them in parallel in this way?
self.t_gate = self.ttl1.gate_rising(60*s)
if self.ttl1.timestamp_mu(self.t_gate) >= 0:
print("No start signal received!")
2) Use the
watch-API to continously check the value of the TTL input on port 1 and execute the experiment once the value is high. This works, but a delay in between checks of port 1 of roughly 5 us is necessary to avoid RTIOUnderflows. This is too long for the intended application, sadly. Is it possible to speed up the update rate of this procedure below 1 us?
If there is any other method, that is better for this problem, I am happy to learn and check if this works more easily with the application.