12-02-2015 07:16 AM
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
10-18-2016 08:59 AM
noone?
10-18-2016 09:11 AM
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
10-18-2016 10:32 AM
that's a nice link, thanks!
dont' know yet if your answer helps to solve the problem, but definitely helps me.
cheers
Igor