Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

imgSessionStatus and buffer numbers

I am developing an app with NI-IMAQ, and have a question about the imgSessionStatus function.

API
===
rval = imgSessionStatus(SESSION_ID sid, uInt32* status, uInt32* bufferNumber);

Question
========
Does bufferNumber represent the # of the last buffer that was acquired and filled, or the # of the buffer that is about to be filled, but not filled yet? My program's logic would be slightly different, depending on this, and might help me to debug a problem.

Background
==========

I am developing an application with an NI PCI-1422. I need to acquire a fast sequence of frames, triggering each from via a bit on a parallel port. I do the following:

set up a session for acquiring 50 buffers
(assume that first bufferNumb
er will be 0.)
loop:
trigger via parallel port bit
wait till imgSessionStatus increments bufferNumber
(do something app specific)
go to loop

My camera is _supposed_ to generate exactly one LVDS frame per trigger.

Sometimes my loop above gets stuck (infinite loop) i.e. bufferNumber just doesn't increment when I expect it to do so.

I'm trying to decide:
1. did my camera fail to generate a frame?, or
2. Did the PCI-1422 card drop a frame?, or
3. Was the frame grabbed, but the software has a bug.

An answer to my question above might be relevant, but any other insight available on the problem would help (e.g. does the PCI-1422 sometimes drop frames? If so, is there a flag that I can poll to tell me when this happens? etc...)

My system is a P-4, 3GHz, 2GB RAM.

Thanks

Frank
0 Kudos
Message 1 of 3
(3,083 Views)
The answer to your main question: The buffer number corresponds to the last buffer filled. Until the first buffer is filled, you should get -1 as the buffer number.

I don't think the PCI-1422 will drop a frame. Most likely, it wasn't ready when the frame was generated (perhaps two frames too close together???) or the proper trigger signal was not generated, or there could be a timeout.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 3
(3,083 Views)
Bruce,

Thanks for your answer. I am still having a problem.
If I ask for a session (imgSequenceSetup), with say
5 buffers, I see 5 triggers, and 5 pulses on the
frameSync pin of the frame grabber, but the buffer
frame numbers that I see are -1, 0, 1, 2, 3 (it never
gets to 4, even though a trigger went to the camera
and a frame sync came out of the camera). In fact,
if I then throw 1000 triggers at it, it never gets
to 4, and status stays at 1, never going to 0...

If I ask for N frames, I seem to get N-1, but not
the last one, and status stays a 1, never going to
0.

Any ideas?

Thanks

Frank
0 Kudos
Message 3 of 3
(3,083 Views)