Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronizing video capture with motion

I am developing a C application using imaq and flexmotion. I have programmed the motion controller to generate breakpoints along
a movement of a single axis using RTSI1.

I want to put the frame grabber (PCI-1422) in continuous "triggered" data acquisiton mode with rings and the RTSI1 line as the trigger.
When the breakpoint is set I want the camera to acquire a SINGLE frame into the ring buffer and execute a callback function when the buffer
has been transfered to memory and is ready for processing.

I have looked at the "triggered snap.c" function but it doesn't do continuous acquisition, it only snaps a single frame.

I have attempted the following but my callback function is only executed once.


...
...
...
imgSessionTriggerConfigure(Sid, IMG_EXT_RTSI1, IMG_TRIG_POLAR_ACTIVEH, 0xffffffff, IMG_TRIG_ACTION_BUFFER);
imgRingSetup (Sid, NUM_RING_BUFFERS, (void**)ImaqBuffers, 0, TRUE);
imgSessionWaitSignalAsync(Sid, IMG_BUF_COMPLETE, IMG_SIGNAL_STATE_HIGH, vidcb, this);
...
...
...


Any help would be greatly appreciated.
JD
0 Kudos
Message 1 of 2
(2,663 Views)
Hello JD2,
What version of the NI-IMAQ driver are you using? Are you using LabWindows/CVI. I am using NI-IMAQ 3.1.1 (the newest version) and I opened the example called "Llring". At line 79 of 276 I made a modification to the code to look like this:

...
...
...
imgInterfaceOpen (intfName, &Iid);
imgSessionOpen (Iid, &Sid);
imgSessionTriggerConfigure2 (Sid, IMG_SIGNAL_RTSI, 0, IMG_TRIG_POLAR_ACTIVEH, 1000, IMG_TRIG_ACTION_BUFFER);
...
...
...

Note that I added the "imgSessionTriggerConfigure2" function to set up a trigger. The "2" comes from newer versions of the NI-IMAQ driver, but yours should work the same.

This made my acquisition trigger a frame into the ring of buffers on every pulse. The timeout is set to 1000 ms, but you could increase this if you needed to.

My suggestion is to take a look at this example and see if it meets your needs.


Nicholas C
National Instruments
Applications Engineering
0 Kudos
Message 2 of 2
(2,651 Views)