Function samples

All of the following samples focus on a single function and are sorted in accordance with the TwinCAT Vision API reference. For each sample there are corresponding images that can be loaded to the PLC via the File Source. In addition, the respective sample descriptions show which function parameters have to be changed in order to see certain effects.

The general steps for starting the function samples are:

1. Add the attached sample images in the file source control.
When using your own images, pay attention to the expected image format, this may vary depending on the example.
2. Activate the configuration and switch TwinCAT and the PLC to Run mode.
You can now see the images from the PLC via View > Other Windows > ADS Image Watch.
- ipImageInDisp always show the input image and
- ipImageResDisp always show the result image
(Both image names can of course be different for you, we have always named the variables the same in the examples so that they can be easily recognized and you can quickly find your way around in any project)
- if required, other images show results of intermediate steps or further information.
Details can be found in the respective sample description.

In the sample descriptions you will also find the function parameters to be written in logged-in Run mode via Prepared value, followed by click on Function samples 1: write values. The effects can then be seen again in the images displayed in Ads Image Watch.

Samples

Sample of writing your own functions

If you repeatedly use certain sequences of TwinCAT Vision API functions for your application, it is a good idea to encapsulate them in a function. The following sample explains what you should observe when doing this:

Example: Self-written functions