Delayed ttl timer/trigger


Recommended Posts


I wonder if someone can give me high level instructions or direct me to the relevant documentation to do the following in DAQFactory:

I have a camera which exposes for 100 ms every 110 ms and sends a TTL pulse that is high during exposure and low in between exposures. I would like to open a separate shutter for 30 ms using a delayed TTL pulse during the high state (during exposure) at a fixed delay after the leading edge of the high pulse. I want LabJack to listen to the camera pulse, and, once it detects the pulse, generate a short TTL pulse after some delay. I guess in short I want to simulate a delayed pulse generator if that makes sense.

I have gotten to the point where I can do continuous reading of my input channel and have a graph of the reads.

how can I implement the following things in DAQFactory:

-detect a leading edge in the imput (from the camera)

-generate a pulse of x ms length with a delay of y ms after the leading edge and output this pulse on a separate channel

thanks for your help,


Link to comment
Share on other sites

It may be tricky to do this reliably in software running in windows. For one, the latency in comms with the LabJack is going to give you 4ms or so of slop, and then if Windows gets busy with something, that could grow to 20ms or more. Acquire mode of DF helps with this, but there's only so much you can do. Windows is simply not a real-time OS, and as far as I know, neither is the USB spec (another reason I prefer serial / ethernet devices). Another problem is the limit on the poll rate. That's going to add even more slop to the timing. Really the only reliable way to do this is either completely in hardware, or using a PCI card and a dual core CPU. It should be easy to do in hardware with a simple timer circuit (ok, probably two timer circuits...)

However, ignoring the above points, scripting it is pretty easy. Let's say your input channel is called "input" and your output called "output". In the event of the Input channel (click on "input" under "CHANNELS:" in the workspace, then select the event tab), put:

if ((input[0] == 1) && (input[1] == 0))

And then create a sequence called pulse:

output = 1
output = 0

replacing x and y with the appropriate lengths (in seconds)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.