Re: [ARTIQ] Reliable Input Event Handling

2016-11-01 Thread Robert Jördens
On Tue, Nov 1, 2016 at 5:25 PM, Aaron Vontell  wrote:
> I am wondering what the best way is to place an event into the timeline as
> soon as possible after detecting an input event. For instance, I would like
> to run a pulse on, say, TTL1 immediately after receiving a single rising
> edge on PMT0. For context, I am trying to complete this method which would
> run a kernel / place commands into the timeline upon seeing that the count
> of PMT0 is greater that 0. I am not entirely sure on how to implement this
> functionality, as I commonly run into RTIOUnderflow errors.

Something like this should work. See also the unittests and the tdr example.

latency = seconds_to_mu(1*us)   # or whatever ends up working reliably

t = now_mu()
delay(10*us)
self.ttl2.pulse(10*us)  # connect ttl2 to pmt0

at_mu(t)
self.pmt0.gate_rising(100*us)
r = self.pmt0.timestamp_mu()
if r > 0:  # pulse received during gate
at_mu(r + latency)
self.ttl1.on()

-- 
Robert Jördens.
___
ARTIQ mailing list
https://ssl.serverraum.org/lists/listinfo/artiq


[ARTIQ] Reliable Input Event Handling

2016-11-01 Thread Aaron Vontell
I have been working on handling input events using ARTIQ, by attempting to 
place a pulse event into the buffer / timeline for execution upon receiving an 
input event. I have been following the examples from the manual here 
, 
but I am wondering if there is a way to do even faster handling for input 
events. In the given examples it is safest to place a delay to ensure that gate 
closing event has occurred, but is there a way to instead let the gate close 
while executing a pulse on another TTL line at the same time?

I am wondering what the best way is to place an event into the timeline as soon 
as possible after detecting an input event. For instance, I would like to run a 
pulse on, say, TTL1 immediately after receiving a single rising edge on PMT0. 
For context, I am trying to complete this method 

 which would run a kernel / place commands into the timeline upon seeing that 
the count of PMT0 is greater that 0. I am not entirely sure on how to implement 
this functionality, as I commonly run into RTIOUnderflow errors.

Aaron Vontell___
ARTIQ mailing list
https://ssl.serverraum.org/lists/listinfo/artiq