Generating Halcon Acquisition Code

Halcon lets you insert acquisition code into your code in the IDE.

To generate acquisition code:

1. In Halcon, in the Assistants menu, click Open New Image Acquisition.
2. In the dialog that opens, in the Code Generation tab, set Acquisition Mode to Asynchronous Acquisition.

3. Under Acquisition, click Insert Code to generate the code that will open the acquisition device.

To handle cases when the grab_image function times out while waiting for data, add a try-catch statement around the grab_image function code.

After the example code is generated, you should add a catch instruction to bypass the acquisition timeout event, and use the Go2GenTL_ParseData function to extract information from the returned image.

An example, Continuous_Acq.hdev, is included in the Examples/Halcon directory.