Workflow for I/O devicesπ
Controlling I/O devicesπ
Depending on the used I/O device interface, certain actions may be performed on the interface before a connection to an actual device is being established.
As an example, the OPC UA interface uses this mechanism to handle certificates for encrypted data acquisition sessions.
These I/O interface actions are performed using the operator control_io_interface.
See the documentation of your I/O device interface for detailed information.
Opening a connectionπ
You can query the available devices and other information of your I/O device interface using the operator query_io_interface.
When connecting to your date acquisition device with open_io_device, the main parameters are the name of the corresponding HALCON I/O device interface and the name of the device itself.
As a result, you obtain a so-called handle, with which you can access the device later, e.g., to open a transmission channel.
Using the obtained handle of the transmission channel, you can acquire date with read_io_channel or write_io_channel.
With the generic parameters of open_io_device you can describe the configuration of your I/O device, which is necessary when using more complex configurations.
Detailed information about the parameters of open_io_device can be found in the documentation of your I/O device interface.
More information is available for download from MVTecβs web server under MVTecInterfacesWWW.
Setting I/O device parametersπ
As described above, you can already set parameters when connecting to the I/O device with open_io_device.
These parameters are the so-called generic parameters, because they are specific to the corresponding I/O interfaces.
However, data acquisition devices differ widely regarding the provided functionality, leading to many more special parameters.
These parameters can be customized with the operator set_io_device_param.
With the operator get_io_device_param you can query the current values of the parameters.
Reading and writing dataπ
Having opened a transmission channel, you read and write values using the operators read_io_channel and write_io_channel, respectively.
Closing the connectionπ
At the end of the application, you close the connection to the I/O transmission channel and the device to free its resources by first calling the operator close_io_channel, followed by the operator close_io_device.