Skip to content

I/O devices🔗

HALCON supports I/O devices to perform data-acquisition, e.g., to read sensor values or write control data. To let you concentrate on the actual machine vision problem, HALCON provides you with interfaces performing this interaction for a large number of I/O devices (see MVTec website).

Within your HALCON application, communication with I/O devices is thus reduced to a few lines of code, that is, a few operator calls. What’s more, this simplicity is not achieved at the cost of limiting the available functionality.

graph TD
    A[Control I/O device] --> B[Open connection]
    B --> C[Set parameters]
    C --> D[Read/Write data]
    D --> E[Close connection]
Basic example for reading values from an I/O device
open_io_device (IOInterfaceName, DeviceName[0], [], [], IoDeviceHandle)
query_io_device (IoDeviceHandle, [], 'io_channel_names.digital_input', ChannelsInput)
open_io_channel (IoDeviceHandle, ChannelsInput[Channel0], [], [], IoHandle0)
read_io_channel (IoHandle0, Value0, Status0)
close_io_channel ([IoHandle0,IoHandle1])
close_io_device (IoDeviceHandle)

Unsupported I/O devices

If you want to use an I/O device that is currently not supported by HALCON, i.e., for which no HALCON I/O device interface exists, you can create your own interface. A description how to create and integrate an I/O device interface as well as a template source code that can be used as the basis of an integration can be downloaded from the MVTec website.