Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI1424 - invalid buffer with triggered onboard memory aqcuisition

Solved!
Go to solution

Hello,

 

I need to capture 2 images at a very short interval using a PCI-1424 and a Kodak/Redlake camera. I have to use the onboard memory to grab the images. Using the example

\National Instruments\CVI\samples\IMAQ\Ring\ring onboard mem.prj, I added the following code in 'int CVICALLBACK Ring'

 

// Open an interface and a session
   imgInterfaceOpen (intfName, &Iid);
   imgSessionOpen (Iid, &Sid);
   

// ADDITIONAL CODE fOR TRIGGERING

res = imgSessionTriggerConfigure2 (Sid, IMG_SIGNAL_EXTERNAL, 0, IMG_TRIG_POLAR_ACTIVEH, 5000, IMG_TRIG_ACTION_BUFFER);
  

When the program is executed, a timer checks if a valid buffer is available:

 

int CVICALLBACK Imaq_loop (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 /* definitions here */

 static unsigned int lastBufNum = 0xFFFFFFFF; 
 
 switch (event) {
  case EVENT_TIMER_TICK:

   
   imgGetAttribute (Sid, IMG_ATTR_LAST_VALID_BUFFER, &currBufNum);
   if((currBufNum == lastBufNum) || (currBufNum == 0xFFFFFFFF))
    return 0;

 

On my old NT system with NI-IMAQ 2.2, the value of &currBuffNum form imgGetAttribute was always 0xFFFFFFFF until the first trigger was received, so basically, return 0; was executed up to the first trigger.

 

On XP with NI-IMAQ 4.0 the first value of currBufNum is always 0 and the call

imgSessionCopyBuffer (Sid, currBufNum, CopyBuffer, FALSE);

 

waits until the trigger occurs... with the side effect, that the image is not really in buffer 0.

 

Is this difference between IMAQ2.2. and 4.0 intentional or am I missing something?\

 

Regards

 

Roland

0 Kudos
Message 1 of 3
(3,363 Views)

Hi Roland,

 

Are you able to get the example to work with triggering?  Or is the buffer number difference causing problems?  As to how the IMAQ driver allocates buffers, NI-IMAQ Memory Allocation is a helpful article. In terms of what has changed with the IMAQ driver specifically, What's New with NI-IMAQ details everything from IMAQ 2.5 to the current version (4.0).  

 

Regards,

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 2 of 3
(3,325 Views)
Solution
Accepted by topic author Rolboes

I found a workaround. I use the function

 

ImgErrCode = imgSessionStatus(sessionID,&status, &currBufNum);

 

instead of

 

ImgErrCode = imgGetAttribute (sessionID, IMG_ATTR_LAST_VALID_BUFFER,&currBufNum);

 

In this case, currBufNum is 0xFFFFFFFF until the first image is recorded.

 

Roland

0 Kudos
Message 3 of 3
(3,261 Views)