I tried to acquire some image with PCIe-1429 and basler linescan camera spl 4096-140km. But a fatal run-time error was raised. I tried by changing the "Trigger type" in imgSessionTriggerConfigure2(Sid, IMG_SIGNAL_RTSI, 0, IMG_TRIG_POLAR_ACTIVEH, 500, IMG_TRIG_ACTION_BUFFER), but it's still not working. Thank you in advance!
Following is my code:
#include <utility.h>
#include <userint.h>
#include <niimaq.h>
#include <ansi_c.h>
#define NUM_RING_BUFFERS 50
int AcqWinHeight = 400;
int AcqWinWidth = 2048;
int bytesPerPixel = 2;
int bufSize;
int i;
int bufCmd;
int img;
static BUFLIST_ID Bid;
static SESSION_ID Sid;
static INTERFACE_ID Iid;
static Int8* ImaqBuffers[NUM_RING_BUFFERS];
char *CamID = "img0";
int main (int argc, char *argv[])
{
imgInterfaceOpen(CamID,&Iid);
imgSessionOpen(Iid,&Sid);
// Create a buffer list with n elements
imgCreateBufList(NUM_RING_BUFFERS, &Bid);
// Compute the size of the required buffer
imgGetAttribute (Sid, IMG_ATTR_BYTESPERPIXEL, &bytesPerPixel);
bufSize = AcqWinWidth * AcqWinHeight * bytesPerPixel;
/* The following configuration makes theseassignments to the buffer list
elements:
buffer pointer that will contain image
size of the buffer for buffer element 0
command to go to next buffer or loop when the last element is reached
*/
for (i = 0; i < NUM_RING_BUFFERS; i++)
{
imgCreateBuffer(Sid, IMG_HOST_FRAME, bufSize, &ImaqBuffers[i]);
imgSetBufferElement(Bid, i, IMG_BUFF_ADDRESS, (uInt32)ImaqBuffers[i]);
imgSetBufferElement(Bid, i, IMG_BUFF_SIZE, bufSize);
bufCmd = (i == (NUM_RING_BUFFERS - 1)) ? IMG_CMD_LOOP : IMG_CMD_NEXT;
imgSetBufferElement(Bid, i, IMG_BUFF_COMMAND, bufCmd);
}
// Lock down the buffers contained in the buffer list
imgMemLock(Bid);
// Configure the session to use this buffer list
imgSessionConfigure(Sid, Bid);
imgSessionTriggerConfigure2(Sid, IMG_SIGNAL_RTSI, 0, IMG_TRIG_POLAR_ACTIVEH, 500, IMG_TRIG_ACTION_BUFFER);
img = imgSessionExamineBuffer(Sid, ImaqBuffers, NUM_RING_BUFFERS, IMG_BUFF_ADDRESS);
imgSessionReleaseBuffer(Sid);
}