Performing a Ring Acquisition Using Low-Level Functions
The LLRing.c example demonstrates how to perform a ring acquisition using low-level calls. The example sets up a continuous acquisition to multiple buffers allocated by NI-IMAQ.
As described in the low-level snap example, the program retrieves the acquisition window width of the selected camera and aligns it on a 32-bit boundary. It then creates a buffer list to describe the acquisition buffers. Next, the program sets the ROI to the acquisition window width. The program calculates the correct memory requirements of the frame buffer. The program creates the buffer and configures the buffer list for each buffer element in the ring. The program then locks the memory and starts the image acquisition asynchronously.
The main processing loop of the code shows how to wait for the first buffer to be filled and subsequently processed. NI-IMAQ returns a value of 0xFFFFFFFF as the IMG_ATTR_LAST_VALID_BUFFER attribute until the successful acquisition of the first buffer. To guarantee that you wait for the acquisition of a new buffer in a ring with more than one buffer, you can loop on the attribute IMG_ATTR_LAST_VALID_BUFFER until it changes. If your buffer analysis requires many computations, call imgSessionExamineBuffer to extract the appropriate buffer from the live sequence. When you use imgSessionExamineBuffer, the driver does not allow you to write new data into that buffer during the analysis. Use imgSessionReleaseBuffer to return the buffer to the continuous sequence.