Chapter 3 Programming with NI-IMAQ
©
National Instruments Corporation 3-9 NI-IMAQ User Manual
Figure 3-3. Grab Programming Flowchart
The hlgrab.c example demonstrates how to perform a grab using imgGrabArea. The example performs multiple grabs until an appropriate
condition is met. The program configures the session to perform a grab operation by calling the imgGrabSetup function. The program then calculates the area to grabusing the current ROI, rowPixels, and BYTESPERPIXEL, and the acquisition is started by calling imgSessionStartAcquisition. In this example, we allocate our
ownuser buffer for grabbing and pass this buffer to imgGrabArea. When the acquisition is complete, it stops. The program then frees the user buffer and all of the resources associated with this interface by calling imgClose.
imgInterfaceOpen imgInterfaceOpen opens
and configures the interface
according to the file setup by the
IMAQ Configuration Utility.
imgGrab copies the contents of the driver buffer
to a user buffer. This function can be synchronized
to a vertical blank or initiated asynchronously. The
buffer can be passed into imgGrab or automatically
allocated by NI-IMAQ. imgGrab can be called
multiple times for high-speed acquisition.
imgSessionOpen opens a session that
will be used for all acquisition and configuration.
User-specific image processing
imgClose closes the interface and session.
imgGrabSetup configures the interface for a
continuous acquisition.
imgSessionOpen
imgGrabSetup
imgGrab
User-Specific Functions
imgSessionStopAcquisition stops
the grab function.
imgSessionStopAcquisition
imgClose
(Loop)
imgSessionStartAcquisition starts
the acquisition into a driver buffer.
imgSessionStartAcquisition
UM.book Page 9 Monday, July 13, 1998 9:49 AM