Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

NI1433 callback example

hi,

 

for my NI1433 (and a Basler camera) I would like to have an example that shows how to read a Frame with an external trigger and a callback.

I have configured the camera with the NI MAX to trigger on external trigger and I see a moving gradient picture. However with a C++ code (sorry for a reduced copy-paste, which is mostly as-it-is), and I can see only the first call of the callback function when the program starts. It looks like the trigger function is not reset (?). Please see the code below:

 

uInt32 __cdecl Callback(SESSION_ID id, IMG_ERR err, uInt32 signal, void* data) {

printf("callback fired boardid=%x, err=%d, signal=%x, data=%p \n", id, err, signal, data);

return 0;
}

 


int configureFramegrabber(void)
{
int error;
unsigned int bitsPerPixel, plotFlag = 0;
char intfName[64] = "img0";
errChk(imgInterfaceOpen(intfName, &Iid));
printf("imgInterfaceOpen: %#08X \n", Iid);
errChk(imgSessionOpen(Iid, &Sid));
printf("imgSessionOpen: %#08X \n", Sid);

 

 

IMG_SIGNAL_TYPE signalType = IMG_SIGNAL_ISO_IN;

void* callbackData = 0;
errChk(imgSessionWaitSignalAsync2(Sid, signalType, IMG_FRAME_START, IMG_SIGNAL_STATE_LOW, callback2, callbackData));

 

printf("ROI width: %d, height:%d, top:%d, left:%d, bits:%d \n", AcqWinWidth, AcqWinHeight, AcqWinTop, AcqWinLeft, bitsPerPixel);
printf("FULL width: %d, height:%d, top:%d, left:%d \n", CanvasWidth, CanvasHeight, CanvasTop, CanvasLeft);

return 0;

Error:
printf("Error section, error = %d \n", error);
return 0;
}

 

int main(int argc, char* argv[])
{

CHAR ImaqSmplClassName[] = "Imaq Sample";

configureFramegrabber();
Do_MTStuff_Loop();

return 0;
}

 

Could you please point to a working example code?

thanks!

Igor

0 Kudos
Message 1 of 4
(4,095 Views)

noone?

0 Kudos
Message 2 of 4
(3,049 Views)

From http://zone.ni.com/reference/en-XX/help/370161G-01/imaqfr/imgsessionwaitsignalasync2/

Note  The return value of the callback function determines the behavior of the driver for subsequent signal assertions. Return zero to disregard future signal assertions. Return a non-zero value to continue to receive callbacks.

 

Looks like you are returning 0 in your callback.

 

Eric

0 Kudos
Message 3 of 4
(3,045 Views)

that's a nice link, thanks!

dont' know yet if your answer helps to solve the problem, but definitely helps me.

 

cheers

Igor

0 Kudos
Message 4 of 4
(3,037 Views)