11-25-2011 02:00 AM - edited 11-25-2011 02:01 AM
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
11-28-2011 12:56 PM
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
11-28-2011 06:00 PM
11-29-2011 10:34 AM
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
11-29-2011 05:18 PM
11-30-2011 08:14 AM - edited 11-30-2011 08:24 AM
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?
11-30-2011 08:20 AM
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
11-30-2011 10:28 AM
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
12-01-2011 03:52 AM
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..
12-01-2011 10:31 AM
I have an idea, I will write up an example when I get a chance today. Do not give up yet!
Ryan