Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

pulsed camera triggering

Hello,

 

I am quite new to Labview, but have a fair amount of experience developing .Net Code.

 

I am faced with the following problem:

 

I have a camera that has a digital input and output line, a NI PCI 6220 with BNC-2110 connector block. I have wired the camera input line to port0/line0 and the camera output line to port0/line1

 

I need to aquire pairs of images at a certain rate (nominally 5 Hz - so 10 images in 1 second). The time between each image in the pair is governed by the camera read out speed - in order to obtain the smallest interval between images I have configured the camer to use its output line to signal that it is ready to receive a trigger "FrameTriggerReady". This results in the output line being +5V high when the camera is ready to receive a trigger on the input line, low when it is not ready due to an exposure taking place.

 

Based on the WriteDigChan_ExtClk example I have setup a Task with a DigitalOutput line and generated a waveform that has 5 rising edges to trigger the camera at 5Hz using the 100kHzTimebase - working well.

 

From the CountDigEvents example I have configured another task with Timing set to ChangeDetection and an asynchronous event handler to record the number of rising edges I have got from the camera.

 

So far so good, but now I am stuck - I dont know how to initiate the second aquisition, i.e. respond to the "FrameTriggerReady" edge that I have detected.

 

Anyone got any ideas of the best way to accomplish this. I know I cant tie up the output line as I am at the moment with a 1second long waveform, but rather I am hoping that I can maybe design a short waveform (enough to signal the camera) that can be triggered by a 5Hz counter/timer and an asynchronous EdgeDetection event handler. But I cant seem to configure a StartTrigger on a DigitalOut Task...

 

Any help greatly appreciated!

 

-Paul

 

0 Kudos
Message 1 of 11
(4,267 Views)

Hi Paul, 

 

I want to clarify what you are trying to do before we start solving the problem.  

 

One interpretation I have is that you want to be able to take your photo pair as fast as possible, not at 5Hz (that is just a minimum).  Instead of triggering based on your 5Hz time, you would like to trigger the photo as soon as the camera is ready.  The camera communicates that it is ready by raising a line to 5 V, which is read by your PCI 6220.

 

A second thought is that everything you have written is working as you want, but you want to expand your code to do something else.  That something else is the second aquisition you talk about.  What is are you aquiring?  How long do you want to aquire for?  Is it an aquisition or an output (because you mentioned a digital out task).  

 

Once I have a better understanding of your goals, I will be better equiped to help you!

 

Ryan 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 11
(4,249 Views)
Hi Ryan,

Thanks for your assistance. I will try to improve my explanation. The only output is a 5v signal to trigger the camera to aquire an image. This signal can only be sent when the input is 5v high, indicating the camera is ready.

The image pairs are to be used in particle tracking where the velocity of the imaged particles is obtained by their displacements between the paired images. Due to external factors it is ideal that these pairs be taken with the smallest possible time interval between the two images (indicated by the trigger ready line). I would like to obtain a pair of images 5 times per second(a total of 10 images per second, the start of each pair occurs every 0.2 seconds and the second image occurs some small amount of time after the first image in the pair)

Hope this helps!

Thanks,
Paul
0 Kudos
Message 3 of 11
(4,246 Views)

Great, now I think I understand. I will re-word the process just to be sure.

 

You have only one camera.  You trigger this camera to take a picture.  Then you wait for the camera to be ready to take a second picture.  As soon as the camera indicated it is ready, you signal the camera to take the second picture.  You then wait another 0.2 seconds to start the process over.

 

I will assume that desciption is right unless you correct me later.

 

You are right in that you cannot tie your output line up with the 1 second signal as you currently have coded.  This will prevent you from signaling your second aquisition.  there are ways to properly handle this

 

Now for my questions, how accurate does your 5Hz rate have to be?  Would 4.9 or 5.1Hz suffice?  Also, do you know how quickly your camera recovers?  How long does the pulse that you send need to be in order to trigger the aquisition?

 

Ryan

Applications Engineer
National Instruments
0 Kudos
Message 4 of 11
(4,239 Views)
Hi Ryan,

The 5hz rate doesn't have to be exact, but would be good if it is constant through an acquisition and that it can be changed, up to maybe 20hz.

The recovery rate is dependant on how large a region of interest I specify in the camera configuration.

I don't have on hand the minimum trigger duration, it is in the camera manual and is maybe 10us.

Thanks,
Paul
0 Kudos
Message 5 of 11
(4,231 Views)

Ok, been thinking about this a bit more and tomorrow when I have access to the equipment I am going to try the following:

 

(1) Setup an DigitalOutput with the 10MhzTimebase and a waveform sufficient to trigger the camera, but dont write to the channel.

 

(2) Setup Counter0 with a 100ms high, 100ms low cycle

Route that to an asynchronous EdgeDetection handler that writes the waveform setup in (1) to the DigitalOut and sets a PulseNext boolean to true

 

(3) Setup a second asynchronous EdgeDetection handler on the camera signal channel that checks the PulseNext boolean and writes the waveform to the DigitalOut then resets the PulseNext boolean to false

 

The only thing I can see that may prevent me doing this is that the continuouse Counter0 may prevent access to the 10Mhz timebase

 

Thoughts?

0 Kudos
Message 6 of 11
(4,226 Views)

Ok, Checked the manual and the trigger width needs to be 3 x the width of the trigger latency, so 3 x 10 us = 30us

0 Kudos
Message 7 of 11
(4,225 Views)

My main concern is I'm not sure how you will enforce your 5 Hz rate.  If you have an idea, go ahead and try it, maybe I am missing something in your description.  I think you are generally on the right track, let me know how it goes, I may have some additional suggestions if this does not work.

 

Ryan

Applications Engineer
National Instruments
0 Kudos
Message 8 of 11
(4,219 Views)

Hi Ryan,

 

Well it was as you suspected, due to all the callback functions the time to move through the hardware and software meant that I was getting highly variable frame rate and was limited to about 10Hz max.

 

I really need some help here, I am beginning to think this isnt going to be as achievable as I had hoped. 

 

I need hardware timed triggering at 5Hz, with a single counter I can get this happening no problem... maybe I should giveup on the "dynamic" triggering of the second image in the pair and resort to measuring the camera recovery time for a given scan size and manually construct a hardware timed pulsed waveform 😞 ... probably more deterministic anyway..

0 Kudos
Message 9 of 11
(4,210 Views)

I have an idea, I will write up an example when I get a chance today.  Do not give up yet!

 

Ryan

Applications Engineer
National Instruments
0 Kudos
Message 10 of 11
(4,204 Views)